Skip to content

golangee/sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sql

Package sql provides a meta-model and parsers for different sql dialect (currently only mysql).

The converter can do several things with SQL-CREATE statements:

  • Multiple SQL-CREATE statements can be converted from a string to a model from the model package using the parser package.
  • The model can be converted back into an SQL string using the normalize package. Attributes, quotes and properties are unified and sorted.
  • The diagram package can be used to create a textual representation from a model, which can be converted into an SVG using the dot command provided by Graphviz, if this is installed.

Via make test all tests are started.

mysql

The grammar has already been converted into go-code, but can be generated again with make grammar. The files MySqlLexer.g4 and MySqlParser.g4 are then translated into the folder dialect/mysql/parser. For this, ANTLR4 must be installed.

how to

go install github.com/golangee/sql/cmd/eesqlconv@latest
eesqlconv testdata/music.sql svg > test.svg

About

Package sql provides a meta-model and parsers for different sql dialects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published