Skip to content

v0.1.0

Choose a tag to compare

@rfberaldo rfberaldo released this 20 Mar 15:46

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.