Go to file
jeff 7c30c3c72b Rewrite to create a connection and prepare queries in one call. Stmts is no longer exposed to the user. An init SQL is added to initialize a database before preparing queries. 2022-03-03 19:01:05 -08:00
simplesql_test Rewrite to create a connection and prepare queries in one call. Stmts is no longer exposed to the user. An init SQL is added to initialize a database before preparing queries. 2022-03-03 19:01:05 -08:00
.gitignore init 2020-07-14 14:59:39 -07:00
README.md Rewrite to use embed.FS and sqlx. 2022-01-02 19:46:54 -08:00
go.mod Rewrite to create a connection and prepare queries in one call. Stmts is no longer exposed to the user. An init SQL is added to initialize a database before preparing queries. 2022-03-03 19:01:05 -08:00
go.sum Rewrite to use embed.FS and sqlx. 2022-01-02 19:46:54 -08:00
simplesql.go Rewrite to create a connection and prepare queries in one call. Stmts is no longer exposed to the user. An init SQL is added to initialize a database before preparing queries. 2022-03-03 19:01:05 -08:00

README.md

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.