/minisql

Primary LanguageGoApache License 2.0Apache-2.0

MiniSQL

Go Reference Test License

A minimal SQL query builder for Go.

Usage

func GetUserName(ctx context.Context, db *sql.DB, userID int64) (string, error) {
  query := minisql.Pooled()
  defer minisql.Release(query)

  query.AppendString(`SELECT user.name FROM users WHERE id = `)
  query.AppendValue(userID)

  var name string
  err := query.QueryRowContext(ctx, db).Scan(&name)
  return name, err
}

Documentation

Please see the API documentation for package and API descriptions and examples.