spar

module
v0.0.0-...-2e2f811 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2020 License: MIT

README

spar

Cloud Spanner DDL parser in Go base on syucream's work. New version support one kind of comment on it because we need to use this library to generate model json file automatically and the comments can be used as the description of fields.

For now, only this kind of comments is accepted :

CREATE TABLE Singers (
  SingerId   INT64 NOT NULL, /* id of the singer */
  FirstName  STRING(1024),
  LastName   STRING(1024),
  SingerInfo BYTES(MAX),
  BirthDate  DATE,
) PRIMARY KEY (SingerId);

Usage

  • Pass your Spanner DDL to parser.Parse() and get parsed statements.
  • See detail on cmd/spck/spck.go

subtool

spck is a Spanner DDL syntax checker. It parses and returns exit code 0 if no error.

$ go get -u github.com/CuberL/spar/cmd/spck
$ spck ./examples/create_table.sql

Directories

Path Synopsis
cmd
src
lexer
Copy from https://github.com/benbjohnson/sql-parser
Copy from https://github.com/benbjohnson/sql-parser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL