simplesql_test | ||
.gitignore | ||
go.mod | ||
go.sum | ||
README.md | ||
simplesql.go |
simplesql
simplesql is a Go library to simplify using prepared statements. It is built on top of sqlx.
Use
To use simplesql, embed a directory of files in a Go program. Call simplesql.Prepare with the embedded FS.
- The embedded directory is expected to be named "sqlq".
- Files must have the extension ".sql".
- Queries must be written using named parameters.
After calling Prepare successfully, a Stmts type is returned. This maps the file name to the prepared statement in the file.
See the test package for a working example.