-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f89ad3d
commit 9c5ef1e
Showing
19 changed files
with
559 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "docs/themes/hugo-coder"] | ||
path = docs/themes/hugo-coder | ||
url = https://github.com/luizdepra/hugo-coder.git | ||
[submodule "docs/themes/hugo-whisper-theme"] | ||
path = docs/themes/hugo-whisper-theme | ||
url = https://github.com/jugglerx/hugo-whisper-theme.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources/ | ||
public/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,41 @@ | ||
baseURL = "http://example.org/" | ||
languageCode = "en-us" | ||
title = "My New Hugo Site" | ||
baseurl = "https://makenowjust.github.io/memefish" | ||
title = "méméfish" | ||
theme = "hugo-whisper-theme" | ||
languagecode = "en" | ||
defaultcontentlanguage = "en" | ||
|
||
paginate = 20 | ||
canonifyurls = true | ||
|
||
pygmentsstyle = "bw" | ||
pygmentscodefences = true | ||
pygmentscodefencesguesssyntax = true | ||
|
||
summaryLength = 30 | ||
|
||
[params] | ||
homepage_button_link = "/docs" | ||
homepage_button_text = "Read The Docs" | ||
homepage_intro = "the foundation to analyze Spanner SQL" | ||
homepage_image = "/images/terminal.svg" | ||
|
||
[params.logo] | ||
mobile = "/images/memefish.svg" | ||
standard = "/images/memefish.svg" | ||
|
||
[[menu.main]] | ||
name = "Docs" | ||
weight = 1 | ||
url = "/docs/" | ||
[[menu.main]] | ||
name = "Demo" | ||
weight = 2 | ||
url = "/demo/" | ||
[[menu.main]] | ||
name = "GoDoc" | ||
weight = 3 | ||
url = "https://godoc.org/github.com/MakeNowJust/memefish/pkg" | ||
[[menu.main]] | ||
name = "GitHub" | ||
weight = 3 | ||
url = "https://github.com/MakeNowJust/memefish" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
date: 2020-02-03 00:00:00 +0900 | ||
title: "Example: analyze" | ||
weight: 2 | ||
--- | ||
|
||
This example shows how to analyze a Spanner SQL after parsing. | ||
|
||
<!--more--> | ||
|
||
## Code | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/MakeNowJust/memefish/pkg/analyzer" | ||
"github.com/MakeNowJust/memefish/pkg/parser" | ||
"github.com/MakeNowJust/memefish/pkg/token" | ||
) | ||
|
||
func main() { | ||
// Create a new Parser instance. | ||
file := &token.File{ | ||
Buffer: "SELECT * FROM singers", | ||
} | ||
p := &parser.Parser{ | ||
Lexer: &parser.Lexer{File: file}, | ||
} | ||
|
||
// Do parsing! | ||
stmt, err := p.ParseQuery() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Create table catalog. | ||
catalog := &analyzer.Catalog{ | ||
Tables: map[string]*analyzer.TableSchema{ | ||
"SINGERS": { | ||
Name: "Singers", | ||
Columns: []*analyzer.ColumnSchema{ | ||
{Name: "SingerId", Type: analyzer.Int64Type}, | ||
{Name: "FirstName", Type: analyzer.StringType}, | ||
{Name: "LastName", Type: analyzer.StringType}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
// Create a new Analyzer instance. | ||
a := &analyzer.Analyzer{ | ||
File: file, | ||
Catalog: catalog, | ||
} | ||
|
||
// Analyze! | ||
err = a.AnalyzeQueryStatement(stmt) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Get first column information. | ||
columns := a.NameLists[stmt.Query] | ||
fmt.Printf("1st column name : %s\n", columns[0].Text) | ||
fmt.Printf("1st column type : %s\n", columns[0].Type) | ||
fmt.Printf("1st column schema: %#v\n", columns[0].Deref().ColumnSchema) // == catalog.Tables["SINGERS"].Columns[0] | ||
} | ||
``` | ||
|
||
## Links | ||
|
||
- [analyzer - GoDoc](https://godoc.org/github.com/MakeNowJust/memefish/pkg/analyzer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
date: 2020-02-03 00:00:00 +0900 | ||
title: "Example: parse and unparse" | ||
weight: 1 | ||
--- | ||
|
||
This example shows how to parse a Spanner SQL and unparse it. | ||
|
||
<!--more--> | ||
|
||
## Code | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/MakeNowJust/memefish/pkg/parser" | ||
"github.com/MakeNowJust/memefish/pkg/token" | ||
"github.com/k0kubun/pp" | ||
) | ||
|
||
func main() { | ||
// Create a new Parser instance. | ||
file := &token.File{ | ||
Buffer: "SELECT * FROM customers", | ||
} | ||
p := &parser.Parser{ | ||
Lexer: &parser.Lexer{File: file}, | ||
} | ||
|
||
// Do parsing! | ||
stmt, err := p.ParseQuery() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Show AST. | ||
log.Print("AST") | ||
_, _ = pp.Println(stmt) | ||
|
||
// Unparse AST to SQL source string. | ||
log.Print("Unparse") | ||
fmt.Println(stmt.SQL()) | ||
} | ||
``` | ||
|
||
## Links | ||
|
||
- [ast - GoDoc](https://godoc.org/github.com/MakeNowJust/memefish/pkg/ast) | ||
- [parser - GoDoc](https://godoc.org/github.com/MakeNowJust/memefish/pkg/parser) | ||
- [Query Syntax | Cloud Spanner | Google Cloud](https://cloud.google.com/spanner/docs/query-syntax) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{ define "header_css" }}{{ end }} | ||
{{ define "body_classes" }}page-default-list{{ end }} | ||
{{ define "header_classes" }}{{ end }} | ||
|
||
{{ define "main" }} | ||
|
||
<h1 class="title">{{ .Title }}</h1> | ||
<div class="content"> | ||
{{ .Content }} | ||
</div> | ||
|
||
{{ end }} |
Oops, something went wrong.