Skip to content

Releases: rfberaldo/sqlz

v0.2.3

23 Aug 12:42
Compare
Choose a tag to compare
  • feat: batch insert now works with suffix clauses (ON DUPLICATE KEY, ON CONFLICT clauses after values)

v0.2.2

06 May 14:46
Compare
Choose a tag to compare
  • fix: return correct error on QueryRow (#4)

v0.2.1

25 Mar 15:28
Compare
Choose a tag to compare
  • fix: do not spread []byte values

v0.2.0

21 Mar 21:53
Compare
Choose a tag to compare
  • feat: support non-english characters (#2)
  • small performance adjustments

v0.1.1

21 Mar 15:31
Compare
Choose a tag to compare
  • Fix batch inserts ending with a mix of whitespaces and semicolon
  • Fix exec with 'IN' clause and default placeholders
  • Better performance for batch inserts

v0.1.0

20 Mar 15:46
Compare
Choose a tag to compare

Package sqlz is a wrapper around sql.DB and sql.Tx. Primary features are:

  • Easy to use: it has a simple API for everyday use that can handle several use cases.
  • Lightweight: performance is similar to sqlx, and only has one dependency.

It has only 3 main methods that can handle different use cases:

Query(ctx context.Context, dst any, query string, args ...any) error
QueryRow(ctx context.Context, dst any, query string, args ...any) error
Exec(ctx context.Context, query string, args ...any) (sql.Result, error)

Both Query/QueryRow execute the query and scan the returned rows into the dst parameter, it works with default or named placeholders, passing a struct or map on args works as a named query.

Exec is similar, passing array/slice as args will be treated as a batch insert.