Documentation ¶
Index ¶
- func Get[T any](stmt *sqlx.Stmt, args ...any) (dest *T, err error)
- func GetContext[T any](ctx context.Context, stmt *sqlx.Stmt, args ...any) (dest *T, err error)
- func InGet[T any](q sqlx.Queryable, query string, args ...any) (dest *T, err error)
- func InSelect[T any](q sqlx.Queryable, query string, args ...any) (dest *T, err error)
- func NamedGet[T any](stmt *sqlx.NamedStmt, arg any) (dest *T, err error)
- func NamedGetContext[T any](ctx context.Context, stmt *sqlx.NamedStmt, arg any) (dest *T, err error)
- func NamedSelect[T any](stmt *sqlx.NamedStmt, arg any) (dest *T, err error)
- func NamedSelectContext[T any](ctx context.Context, stmt *sqlx.NamedStmt, arg any) (dest *T, err error)
- func Select[T any](stmt *sqlx.Stmt, args ...any) (dest *T, err error)
- func SelectContext[T any](ctx context.Context, stmt *sqlx.Stmt, args ...any) (dest *T, err error)
- func StructScan[T any](rows *sqlx.Rows) (dest *T, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get[T] using the prepared statement. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.
func GetContext ¶
GetContext[T] using the prepared statement. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.
func InGet ¶
InGet[T] for in scene does a QueryRow using the provided Queryer, and scans the resulting row to dest. If dest is scannable, the result must only have one column. Otherwise, StructScan is used. Get will return sql.ErrNoRows like row.Scan would. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.
func InSelect ¶
InSelect[T] for in scene executes a query using the provided Queryer, and StructScans each row into dest, which must be a slice. If the slice elements are scannable, then the result set must have only one column. Otherwise, StructScan is used. The *sql.Rows are closed automatically. Any placeholder parameters are replaced with supplied args.
func NamedGet ¶
NamedGet[T] using this NamedStmt Any named placeholder parameters are replaced with fields from arg.
func NamedGetContext ¶
func NamedGetContext[T any](ctx context.Context, stmt *sqlx.NamedStmt, arg any) (dest *T, err error)
NamedGetContext using this NamedStmt Any named placeholder parameters are replaced with fields from arg.
func NamedSelect ¶
NamedSelect using this NamedStmt Any named placeholder parameters are replaced with fields from arg.
func NamedSelectContext ¶
func NamedSelectContext[T any](ctx context.Context, stmt *sqlx.NamedStmt, arg any) (dest *T, err error)
NamedSelectContext using this NamedStmt Any named placeholder parameters are replaced with fields from arg.
func Select ¶
Select[T] using the prepared statement. Any placeholder parameters are replaced with supplied args.
func SelectContext ¶
SelectContext[T] using the prepared statement. Any placeholder parameters are replaced with supplied args.
func StructScan ¶
StructScan[T] all rows from an sql.Rows or an sqlx.Rows into the dest slice. StructScan[T] will scan in the entire rows result, so if you do not want to allocate structs for the entire result, use Queryx and see sqlx.Rows.StructScan. If rows is sqlx.Rows, it will use its mapper, otherwise it will use the default.
Types ¶
This section is empty.