Documentation
¶
Index ¶
- Constants
- Variables
- func BindAnyArgs(names []string, arg any, m *reflectx.Mapper) ([]any, error)
- func BindDriver(driverName string, bindType int)
- func BindNamed(bindType int, query string, arg any) (string, []any, error)
- func BindType(driverName string) int
- func CompileNamedQuery(qs []byte, bindType int) (query string, names []string, err error)
- func In(query string, args ...any) (string, []any, error)
- func Named(query string, arg any) (string, []any, error)
- func Rebind(bindType int, query string) string
Constants ¶
const ( UNKNOWN = iota QUESTION DOLLAR NAMED AT )
Bindvar types supported by Rebind, BindMap and BindStruct.
Variables ¶
var ErrBindMismatch = errors.New("sqlx: bind count mismatch")
ErrBindMismatch is returned when there is a mismatch between binding variables and parameters.
var ErrColumnNotFound = errors.New("sqlx: column not found")
ErrColumnNotFound is returned when a column from the database cannot be mapped to a destination.
var ErrNamedPropertyNotFound = errors.New("sqlx: named property not found")
ErrNamedPropertyNotFound is returned when a named parameter cannot be found in the provided struct or map.
var ErrSyntax = errors.New("sqlx: query syntax error")
ErrSyntax is returned when there is a syntax error in the query parsing.
var ErrUnsupportedType = errors.New("sqlx: unsupported type")
ErrUnsupportedType is returned when an unsupported type is provided for binding.
Functions ¶
func BindAnyArgs ¶
BindAnyArgs is public mapping logic used by named queries to bind struct args dynamically.
func BindDriver ¶
BindDriver sets the BindType for driverName to bindType.
func CompileNamedQuery ¶
CompileNamedQuery is public mapping logic used by the prepared named queries internally. It returns a defensive copy of the cached names slice to prevent external callers from poisoning the compile cache (e.g. via NamedStmt.Params mutation).
func In ¶
In expands slice values in args, returning the modified query string and a new arg list that can be executed by a database. The `query` should use the `?` bindVar. The return value uses the `?` bindVar.
Types ¶
This section is empty.