{"id":37214584,"url":"https://github.com/h3ndrk/go-sqlite-createtable-parser","last_synced_at":"2026-01-15T00:49:58.429Z","repository":{"id":73979676,"uuid":"217868734","full_name":"h3ndrk/go-sqlite-createtable-parser","owner":"h3ndrk","description":"A parser for sqlite create table sql statements, a Go binding.","archived":false,"fork":false,"pushed_at":"2019-10-28T05:28:54.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T13:30:58.934Z","etag":null,"topics":["go","parse","parser","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/h3ndrk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-27T14:40:13.000Z","updated_at":"2020-06-15T14:06:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"79d6a863-f987-4a48-bdc9-5228d7419e19","html_url":"https://github.com/h3ndrk/go-sqlite-createtable-parser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/h3ndrk/go-sqlite-createtable-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3ndrk%2Fgo-sqlite-createtable-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3ndrk%2Fgo-sqlite-createtable-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3ndrk%2Fgo-sqlite-createtable-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3ndrk%2Fgo-sqlite-createtable-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h3ndrk","download_url":"https://codeload.github.com/h3ndrk/go-sqlite-createtable-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3ndrk%2Fgo-sqlite-createtable-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28440520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:34:46.850Z","status":"ssl_error","status_checked_at":"2026-01-15T00:34:46.551Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","parse","parser","sqlite","sqlite3"],"created_at":"2026-01-15T00:49:57.848Z","updated_at":"2026-01-15T00:49:58.423Z","avatar_url":"https://github.com/h3ndrk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-sqlite-createtable-parser\n\nThis repository contains a Golang binding for [sqlite-createtable-parser](https://github.com/marcobambini/sqlite-createtable-parser) (MIT license). The underlying sqlite-createtable-parser is a parser for SQLite `CREATE TABLE` statements (see [syntax](https://www.sqlite.org/lang_createtable.html)).\n\nFrom [sqlite-createtable-parser/README.md](https://github.com/marcobambini/sqlite-createtable-parser/blob/master/README.md):\n\n\u003e ## Motivation\n\u003e \n\u003e [SQLite](https://www.sqlite.org/) is a very powerful software but it lacks an easy way to extract complete information about tables and columns constraints. This drawback in addition to the lack of full ALTER TABLE support makes alterring a table a very hard task. The built-in sqlite pragmas provide incomplete information and a manual parsing is required in order to extract all the metadata from a table.\n\n## Installation\n\nA C99 compiler is required.\n\n```bash\ngo get github.com/h3ndrk/go-sqlite-createtable-parser@v1.0.0\n```\n\n## How to use\n\n```go\nstmt, err := parse.FromString(\"CREATE TABLE main.tbl (a INTEGER, b TEXT, FOREIGN KEY(a) REFERENCES othertbl(id))\")\nif err != nil {\n    // handle error\n    panic(err)\n}\n\nfmt.Println(stmt)\n// \u0026parse.Table{\n//     Schema:           \u0026\"main\",\n//     Name:             \u0026\"tbl\",\n//     Temporary:        false,\n//     IfNotExists:      false,\n//     WithoutRowid:     false,\n//     Columns:          []parse.Column{\n//         parse.Column{\n//             Name:               \u0026\"a\",\n//             Type:               \u0026\"INTEGER\",\n//             Length:             nil,\n//             ConstraintName:     nil,\n//             PrimaryKey:         false,\n//             Autoincrement:      false,\n//             NotNull:            false,\n//             Unique:             false,\n//             PrimaryKeyOrder:    parse.OrderNone,\n//             PrimaryKeyConflict: parse.ConflictNone,\n//             NotNullConflict:    parse.ConflictNone,\n//             UniqueConflict:     parse.ConflictNone,\n//             Check:              nil,\n//             Default:            nil,\n//             CollateName:        nil,\n//             ForeignKey:         nil,\n//         },\n//         parse.Column{\n//             Name:               \u0026\"b\",\n//             Type:               \u0026\"TEXT\",\n//             Length:             nil,\n//             ConstraintName:     nil,\n//             PrimaryKey:         false,\n//             Autoincrement:      false,\n//             NotNull:            false,\n//             Unique:             false,\n//             PrimaryKeyOrder:    parse.OrderNone,\n//             PrimaryKeyConflict: parse.ConflictNone,\n//             NotNullConflict:    parse.ConflictNone,\n//             UniqueConflict:     parse.ConflictNone,\n//             Check:              nil,\n//             Default:            nil,\n//             CollateName:        nil,\n//             ForeignKey:         nil,\n//         },\n//     },\n//     TableConstraints: []parse.TableConstraint{\n//         parse.TableConstraint{\n//             Name:              nil,\n//             Type:              parse.TableConstraintTypeForeignKey,\n//             IndexedColumns:    []parse.IndexedColumn{},\n//             ConflictClause:    parse.ConflictNone,\n//             Check:             nil,\n//             ForeignKeyColumns: []string{\n//                 \"a\",\n//             },\n//             ForeignKey:        \u0026parse.ForeignKey{\n//                 Table:      \u0026\"othertbl\",\n//                 Columns:    []string{\n//                     \"id\",\n//                 },\n//                 OnDelete:   parse.ForeignKeyActionNone,\n//                 OnUpdate:   parse.ForeignKeyActionNone,\n//                 Match:      nil,\n//                 Deferrable: parse.ForeignKeyDeferrableTypeNone,\n//             },\n//         },\n//     },\n// }\n```\n\n## Implementation status\n\nAs of the creation of this repository, [sqlite-createtable-parser](https://github.com/marcobambini/sqlite-createtable-parser) does **not support** parsing `CHECK` **table** constraints. For example\n\n```sql\nCREATE TABLE a (b INTEGER, CHECK (b \u003e= 42));\n```\n\nwill return a `SQL3ERROR_SYNTAX` error. However, `CHECK` **column** constraints are on the other hand **supported** (notice the removed comma):\n\n```sql\nCREATE TABLE a (b INTEGER CHECK (b \u003e= 42));\n```\n\nAll other syntax of `CREATE TABLE` is **supported**. This repository adds many tests to ensure that the parser works.\n\n## License\n\nMIT, see `LICENSE` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh3ndrk%2Fgo-sqlite-createtable-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh3ndrk%2Fgo-sqlite-createtable-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh3ndrk%2Fgo-sqlite-createtable-parser/lists"}