{"modulePath":"github.com/smartcontractkit/sqlx","version":"v1.3.5-0.20210805004948-4be295aacbeb","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sqlx\n\nPackage sqlx provides general purpose extensions to database/sql.\n\nIt is intended to seamlessly wrap database/sql and provide convenience methods which are useful in the development of database driven applications. None of the underlying database/sql methods are changed.  Instead all extended behavior is implemented through new methods defined on wrapper types.\n\nAdditions include scanning into structs, named query support, rebinding queries for different drivers, convenient shorthands for common error handling and more.\n\n## Constants\n\n```go\nconst (\n\tUNKNOWN = iota\n\tQUESTION\n\tDOLLAR\n\tNAMED\n\tAT\n)\n```\nBindvar types supported by Rebind, BindMap and BindStruct.\n\n## Variables\n\n```go\nvar NameMapper = strings.ToLower\n```\nNameMapper is used to map column names to struct field names.  By default, it uses strings.ToLower to lowercase struct field names.  It can be set to whatever you want, but it is encouraged to be set before sqlx is used as name-to-field mappings are cached after first use on a type.\n\n## Functions\n\n```go\nfunc BindDriver(driverName string, bindType int)\n```\nBindDriver sets the BindType for driverName to bindType.\n\n```go\nfunc BindNamed(bindType int, query string, arg interface{}) (string, []interface{}, error)\n```\nBindNamed binds a struct or a map to a query with named parameters. DEPRECATED: use sqlx.Named\\` instead of this, it may be removed in future.\n\n```go\nfunc BindType(driverName string) int\n```\nBindType returns the bindtype for a given database given a drivername.\n\n```go\nfunc Get(q Queryer, dest interface{}, query string, args ...interface{}) error\n```\nGet 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.\n\n```go\nfunc GetContext(ctx context.Context, q QueryerContext, dest interface{}, query string, args ...interface{}) error\n```\nGetContext 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.\n\n```go\nfunc In(query string, args ...interface{}) (string, []interface{}, error)\n```\nIn 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.\n\n```go\nfunc LoadFile(e Execer, path string) (*sql.Result, error)\n```\nLoadFile exec's every statement in a file (as a single call to Exec). LoadFile may return a nil \\*sql.Result if errors are encountered locating or reading the file at path.  LoadFile reads the entire file into memory, so it is not suitable for loading large data dumps, but can be useful for initializing schemas or loading indexes.\n\nFIXME: this does not really work with multi-statement files for mattn/go-sqlite3 or the go-mysql-driver/mysql drivers;  pq seems to be an exception here.  Detecting this by requiring something with DriverName() and then attempting to split the queries will be difficult to get right, and its current driver-specific behavior is deemed at least not complex in its incorrectness.\n\n```go\nfunc LoadFileContext(ctx context.Context, e ExecerContext, path string) (*sql.Result, error)\n```\nLoadFileContext exec's every statement in a file (as a single call to Exec). LoadFileContext may return a nil \\*sql.Result if errors are encountered locating or reading the file at path.  LoadFile reads the entire file into memory, so it is not suitable for loading large data dumps, but can be useful for initializing schemas or loading indexes.\n\nFIXME: this does not really work with multi-statement files for mattn/go-sqlite3 or the go-mysql-driver/mysql drivers;  pq seems to be an exception here.  Detecting this by requiring something with DriverName() and then attempting to split the queries will be difficult to get right, and its current driver-specific behavior is deemed at least not complex in its incorrectness.\n\n```go\nfunc MapScan(r ColScanner, dest map[string]interface{}) error\n```\nMapScan scans a single Row into the dest map\\[string]interface{}. Use this to get results for SQL that might not be under your control (for instance, if you're building an interface for an SQL server that executes SQL from input).  Please do not use this as a primary interface! This will modify the map sent to it in place, so reuse the same map with care.  Columns which occur more than once in the result will overwrite each other!\n\n```go\nfunc MustExec(e Execer, query string, args ...interface{}) sql.Result\n```\nMustExec execs the query using e and panics if there was an error. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc MustExecContext(ctx context.Context, e ExecerContext, query string, args ...interface{}) sql.Result\n```\nMustExecContext execs the query using e and panics if there was an error. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc Named(query string, arg interface{}) (string, []interface{}, error)\n```\nNamed takes a query using named parameters and an argument and returns a new query with a list of args that can be executed by a database.  The return value uses the \\`?\\` bindvar.\n\n```go\nfunc NamedExec(e Ext, query string, arg interface{}) (sql.Result, error)\n```\nNamedExec uses BindStruct to get a query executable by the driver and then runs Exec on the result.  Returns an error from the binding or the query execution itself.\n\n```go\nfunc NamedExecContext(ctx context.Context, e ExtContext, query string, arg interface{}) (sql.Result, error)\n```\nNamedExecContext uses BindStruct to get a query executable by the driver and then runs Exec on the result.  Returns an error from the binding or the query execution itself.\n\n```go\nfunc Rebind(bindType int, query string) string\n```\nRebind a query from the default bindtype (QUESTION) to the target bindtype.\n\n```go\nfunc Select(q Queryer, dest interface{}, query string, args ...interface{}) error\n```\nSelect 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.\n\n```go\nfunc SelectContext(ctx context.Context, q QueryerContext, dest interface{}, query string, args ...interface{}) error\n```\nSelectContext 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.\n\n```go\nfunc SliceScan(r ColScanner) ([]interface{}, error)\n```\nSliceScan a row, returning a \\[]interface{} with values similar to MapScan. This function is primarily intended for use where the number of columns is not known.  Because you can pass an \\[]interface{} directly to Scan, it's recommended that you do that as it will not have to allocate new slices per row.\n\n```go\nfunc StructScan(rows rowsi, dest interface{}) error\n```\nStructScan all rows from an sql.Rows or an sqlx.Rows into the dest slice. StructScan 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.\n\n## Types\n\n```go\ntype ColScanner interface {\n\tColumns() ([]string, error)\n\tScan(dest ...interface{}) error\n\tErr() error\n}\n```\nColScanner is an interface used by MapScan and SliceScan\n\n```go\ntype Conn struct {\n\t*sql.Conn\n\n\tMapper *reflectx.Mapper\n\t// contains filtered or unexported fields\n}\n```\nConn is a wrapper around sql.Conn with extra functionality\n\n```go\nfunc (c *Conn) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)\n```\nBeginTxx begins a transaction and returns an \\*sqlx.Tx instead of an \\*sql.Tx.\n\nThe provided context is used until the transaction is committed or rolled back. If the context is canceled, the sql package will roll back the transaction. Tx.Commit will return an error if the context provided to BeginxContext is canceled.\n\n```go\nfunc (c *Conn) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\nGetContext using this Conn. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.\n\n```go\nfunc (c *Conn) PreparexContext(ctx context.Context, query string) (*Stmt, error)\n```\nPreparexContext returns an sqlx.Stmt instead of a sql.Stmt.\n\nThe provided context is used for the preparation of the statement, not for the execution of the statement.\n\n```go\nfunc (c *Conn) QueryRowxContext(ctx context.Context, query string, args ...interface{}) *Row\n```\nQueryRowxContext queries the database and returns an \\*sqlx.Row. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (c *Conn) QueryxContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)\n```\nQueryxContext queries the database and returns an \\*sqlx.Rows. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (c *Conn) Rebind(query string) string\n```\nRebind a query within a Conn's bindvar type.\n\n```go\nfunc (c *Conn) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\nSelectContext using this Conn. Any placeholder parameters are replaced with supplied args.\n\n```go\ntype DB struct {\n\t*sql.DB\n\n\tMapper *reflectx.Mapper\n\t// contains filtered or unexported fields\n}\n```\nDB is a wrapper around sql.DB which keeps track of the driverName upon Open, used mostly to automatically bind named queries using the right bindvars.\n\n```go\nfunc Connect(driverName, dataSourceName string) (*DB, error)\n```\nConnect to a database and verify with a ping.\n\n```go\nfunc ConnectContext(ctx context.Context, driverName, dataSourceName string) (*DB, error)\n```\nConnectContext to a database and verify with a ping.\n\n```go\nfunc MustConnect(driverName, dataSourceName string) *DB\n```\nMustConnect connects to a database and panics on error.\n\n```go\nfunc MustOpen(driverName, dataSourceName string) *DB\n```\nMustOpen is the same as sql.Open, but returns an \\*sqlx.DB instead and panics on error.\n\n```go\nfunc NewDb(db *sql.DB, driverName string) *DB\n```\nNewDb returns a new sqlx DB wrapper for a pre-existing \\*sql.DB.  The driverName of the original database is required for named query support.\n\n```go\nfunc Open(driverName, dataSourceName string) (*DB, error)\n```\nOpen is the same as sql.Open, but returns an \\*sqlx.DB instead.\n\n```go\nfunc (db *DB) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)\n```\nBeginTxx begins a transaction and returns an \\*sqlx.Tx instead of an \\*sql.Tx.\n\nThe provided context is used until the transaction is committed or rolled back. If the context is canceled, the sql package will roll back the transaction. Tx.Commit will return an error if the context provided to BeginxContext is canceled.\n\n```go\nfunc (db *DB) Beginx() (*Tx, error)\n```\nBeginx begins a transaction and returns an \\*sqlx.Tx instead of an \\*sql.Tx.\n\n```go\nfunc (db *DB) BindNamed(query string, arg interface{}) (string, []interface{}, error)\n```\nBindNamed binds a query using the DB driver's bindvar type.\n\n```go\nfunc (db *DB) Connx(ctx context.Context) (*Conn, error)\n```\nConnx returns an \\*sqlx.Conn instead of an \\*sql.Conn.\n\n```go\nfunc (db *DB) DriverName() string\n```\nDriverName returns the driverName passed to the Open function for this DB.\n\n```go\nfunc (db *DB) Get(dest interface{}, query string, args ...interface{}) error\n```\nGet using this DB. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.\n\n```go\nfunc (db *DB) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\nGetContext using this DB. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.\n\n```go\nfunc (db *DB) MapperFunc(mf func(string) string)\n```\nMapperFunc sets a new mapper for this db using the default sqlx struct tag and the provided mapper function.\n\n```go\nfunc (db *DB) MustBegin() *Tx\n```\nMustBegin starts a transaction, and panics on error.  Returns an \\*sqlx.Tx instead of an \\*sql.Tx.\n\n```go\nfunc (db *DB) MustBeginTx(ctx context.Context, opts *sql.TxOptions) *Tx\n```\nMustBeginTx starts a transaction, and panics on error.  Returns an \\*sqlx.Tx instead of an \\*sql.Tx.\n\nThe provided context is used until the transaction is committed or rolled back. If the context is canceled, the sql package will roll back the transaction. Tx.Commit will return an error if the context provided to MustBeginContext is canceled.\n\n```go\nfunc (db *DB) MustExec(query string, args ...interface{}) sql.Result\n```\nMustExec (panic) runs MustExec using this database. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) MustExecContext(ctx context.Context, query string, args ...interface{}) sql.Result\n```\nMustExecContext (panic) runs MustExec using this database. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) NamedExec(query string, arg interface{}) (sql.Result, error)\n```\nNamedExec using this DB. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (db *DB) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)\n```\nNamedExecContext using this DB. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (db *DB) NamedQuery(query string, arg interface{}) (*Rows, error)\n```\nNamedQuery using this DB. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (db *DB) NamedQueryContext(ctx context.Context, query string, arg interface{}) (*Rows, error)\n```\nNamedQueryContext using this DB. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (db *DB) PrepareNamed(query string) (*NamedStmt, error)\n```\nPrepareNamed returns an sqlx.NamedStmt\n\n```go\nfunc (db *DB) PrepareNamedContext(ctx context.Context, query string) (*NamedStmt, error)\n```\nPrepareNamedContext returns an sqlx.NamedStmt\n\n```go\nfunc (db *DB) Preparex(query string) (*Stmt, error)\n```\nPreparex returns an sqlx.Stmt instead of a sql.Stmt\n\n```go\nfunc (db *DB) PreparexContext(ctx context.Context, query string) (*Stmt, error)\n```\nPreparexContext returns an sqlx.Stmt instead of a sql.Stmt.\n\nThe provided context is used for the preparation of the statement, not for the execution of the statement.\n\n```go\nfunc (db *DB) QueryRowx(query string, args ...interface{}) *Row\n```\nQueryRowx queries the database and returns an \\*sqlx.Row. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) QueryRowxContext(ctx context.Context, query string, args ...interface{}) *Row\n```\nQueryRowxContext queries the database and returns an \\*sqlx.Row. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) Queryx(query string, args ...interface{}) (*Rows, error)\n```\nQueryx queries the database and returns an \\*sqlx.Rows. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) QueryxContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)\n```\nQueryxContext queries the database and returns an \\*sqlx.Rows. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) Rebind(query string) string\n```\nRebind transforms a query from QUESTION to the DB driver's bindvar type.\n\n```go\nfunc (db *DB) Select(dest interface{}, query string, args ...interface{}) error\n```\nSelect using this DB. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\nSelectContext using this DB. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (db *DB) Unsafe() *DB\n```\nUnsafe returns a version of DB which will silently succeed to scan when columns in the SQL result have no fields in the destination struct. sqlx.Stmt and sqlx.Tx which are created from this DB will inherit its safety behavior.\n\n```go\ntype Execer interface {\n\tExec(query string, args ...interface{}) (sql.Result, error)\n}\n```\nExecer is an interface used by MustExec and LoadFile\n\n```go\ntype ExecerContext interface {\n\tExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)\n}\n```\nExecerContext is an interface used by MustExecContext and LoadFileContext\n\n```go\ntype Ext interface {\n\tQueryer\n\tExecer\n\t// contains filtered or unexported methods\n}\n```\nExt is a union interface which can bind, query, and exec, used by NamedQuery and NamedExec.\n\n```go\ntype ExtContext interface {\n\tQueryerContext\n\tExecerContext\n\t// contains filtered or unexported methods\n}\n```\nExtContext is a union interface which can bind, query, and exec, with Context used by NamedQueryContext and NamedExecContext.\n\n```go\ntype NamedStmt struct {\n\tParams      []string\n\tQueryString string\n\tStmt        *Stmt\n}\n```\nNamedStmt is a prepared statement that executes named queries.  Prepare it how you would execute a NamedQuery, but pass in a struct or map when executing.\n\n```go\nfunc (n *NamedStmt) Close() error\n```\nClose closes the named statement.\n\n```go\nfunc (n *NamedStmt) Exec(arg interface{}) (sql.Result, error)\n```\nExec executes a named statement using the struct passed. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) ExecContext(ctx context.Context, arg interface{}) (sql.Result, error)\n```\nExecContext executes a named statement using the struct passed. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) Get(dest interface{}, arg interface{}) error\n```\nGet using this NamedStmt Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) GetContext(ctx context.Context, dest interface{}, arg interface{}) error\n```\nGetContext using this NamedStmt Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) MustExec(arg interface{}) sql.Result\n```\nMustExec execs a NamedStmt, panicing on error Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) MustExecContext(ctx context.Context, arg interface{}) sql.Result\n```\nMustExecContext execs a NamedStmt, panicing on error Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) Query(arg interface{}) (*sql.Rows, error)\n```\nQuery executes a named statement using the struct argument, returning rows. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) QueryContext(ctx context.Context, arg interface{}) (*sql.Rows, error)\n```\nQueryContext executes a named statement using the struct argument, returning rows. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) QueryRow(arg interface{}) *Row\n```\nQueryRow executes a named statement against the database.  Because sqlx cannot create a \\*sql.Row with an error condition pre-set for binding errors, sqlx returns a \\*sqlx.Row instead. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) QueryRowContext(ctx context.Context, arg interface{}) *Row\n```\nQueryRowContext executes a named statement against the database.  Because sqlx cannot create a \\*sql.Row with an error condition pre-set for binding errors, sqlx returns a \\*sqlx.Row instead. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) QueryRowx(arg interface{}) *Row\n```\nQueryRowx this NamedStmt.  Because of limitations with QueryRow, this is an alias for QueryRow. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) QueryRowxContext(ctx context.Context, arg interface{}) *Row\n```\nQueryRowxContext this NamedStmt.  Because of limitations with QueryRow, this is an alias for QueryRow. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) Queryx(arg interface{}) (*Rows, error)\n```\nQueryx using this NamedStmt Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) QueryxContext(ctx context.Context, arg interface{}) (*Rows, error)\n```\nQueryxContext using this NamedStmt Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) Select(dest interface{}, arg interface{}) error\n```\nSelect using this NamedStmt Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) SelectContext(ctx context.Context, dest interface{}, arg interface{}) error\n```\nSelectContext using this NamedStmt Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (n *NamedStmt) Unsafe() *NamedStmt\n```\nUnsafe creates an unsafe version of the NamedStmt\n\n```go\ntype Preparer interface {\n\tPrepare(query string) (*sql.Stmt, error)\n}\n```\nPreparer is an interface used by Preparex.\n\n```go\ntype PreparerContext interface {\n\tPrepareContext(ctx context.Context, query string) (*sql.Stmt, error)\n}\n```\nPreparerContext is an interface used by PreparexContext.\n\n```go\ntype Queryer interface {\n\tQuery(query string, args ...interface{}) (*sql.Rows, error)\n\tQueryx(query string, args ...interface{}) (*Rows, error)\n\tQueryRowx(query string, args ...interface{}) *Row\n}\n```\nQueryer is an interface used by Get and Select\n\n```go\ntype QueryerContext interface {\n\tQueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)\n\tQueryxContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)\n\tQueryRowxContext(ctx context.Context, query string, args ...interface{}) *Row\n}\n```\nQueryerContext is an interface used by GetContext and SelectContext\n\n```go\ntype Row struct {\n\tMapper *reflectx.Mapper\n\t// contains filtered or unexported fields\n}\n```\nRow is a reimplementation of sql.Row in order to gain access to the underlying sql.Rows.Columns() data, necessary for StructScan.\n\n```go\nfunc (r *Row) ColumnTypes() ([]*sql.ColumnType, error)\n```\nColumnTypes returns the underlying sql.Rows.ColumnTypes(), or the deferred error\n\n```go\nfunc (r *Row) Columns() ([]string, error)\n```\nColumns returns the underlying sql.Rows.Columns(), or the deferred error usually returned by Row.Scan()\n\n```go\nfunc (r *Row) Err() error\n```\nErr returns the error encountered while scanning.\n\n```go\nfunc (r *Row) MapScan(dest map[string]interface{}) error\n```\nMapScan using this Rows.\n\n```go\nfunc (r *Row) Scan(dest ...interface{}) error\n```\nScan is a fixed implementation of sql.Row.Scan, which does not discard the underlying error from the internal rows object if it exists.\n\n```go\nfunc (r *Row) SliceScan() ([]interface{}, error)\n```\nSliceScan using this Rows.\n\n```go\nfunc (r *Row) StructScan(dest interface{}) error\n```\nStructScan a single Row into dest.\n\n```go\ntype Rows struct {\n\t*sql.Rows\n\n\tMapper *reflectx.Mapper\n\t// contains filtered or unexported fields\n}\n```\nRows is a wrapper around sql.Rows which caches costly reflect operations during a looped StructScan\n\n```go\nfunc NamedQuery(e Ext, query string, arg interface{}) (*Rows, error)\n```\nNamedQuery binds a named query and then runs Query on the result using the provided Ext (sqlx.Tx, sqlx.Db).  It works with both structs and with map\\[string]interface{} types.\n\n```go\nfunc NamedQueryContext(ctx context.Context, e ExtContext, query string, arg interface{}) (*Rows, error)\n```\nNamedQueryContext binds a named query and then runs Query on the result using the provided Ext (sqlx.Tx, sqlx.Db).  It works with both structs and with map\\[string]interface{} types.\n\n```go\nfunc (r *Rows) MapScan(dest map[string]interface{}) error\n```\nMapScan using this Rows.\n\n```go\nfunc (r *Rows) SliceScan() ([]interface{}, error)\n```\nSliceScan using this Rows.\n\n```go\nfunc (r *Rows) StructScan(dest interface{}) error\n```\nStructScan is like sql.Rows.Scan, but scans a single Row into a single Struct. Use this and iterate over Rows manually when the memory load of Select() might be prohibitive.  \\*Rows.StructScan caches the reflect work of matching up column positions to fields to avoid that overhead per scan, which means it is not safe to run StructScan on the same Rows instance with different struct types.\n\n```go\ntype Stmt struct {\n\t*sql.Stmt\n\n\tMapper *reflectx.Mapper\n\t// contains filtered or unexported fields\n}\n```\nStmt is an sqlx wrapper around sql.Stmt with extra functionality\n\n```go\nfunc Preparex(p Preparer, query string) (*Stmt, error)\n```\nPreparex prepares a statement.\n\n```go\nfunc PreparexContext(ctx context.Context, p PreparerContext, query string) (*Stmt, error)\n```\nPreparexContext prepares a statement.\n\nThe provided context is used for the preparation of the statement, not for the execution of the statement.\n\n```go\nfunc (s *Stmt) Get(dest interface{}, args ...interface{}) error\n```\nGet using the prepared statement. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.\n\n```go\nfunc (s *Stmt) GetContext(ctx context.Context, dest interface{}, args ...interface{}) error\n```\nGetContext using the prepared statement. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.\n\n```go\nfunc (s *Stmt) MustExec(args ...interface{}) sql.Result\n```\nMustExec (panic) using this statement.  Note that the query portion of the error output will be blank, as Stmt does not expose its query. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) MustExecContext(ctx context.Context, args ...interface{}) sql.Result\n```\nMustExecContext (panic) using this statement.  Note that the query portion of the error output will be blank, as Stmt does not expose its query. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) QueryRowx(args ...interface{}) *Row\n```\nQueryRowx using this statement. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) QueryRowxContext(ctx context.Context, args ...interface{}) *Row\n```\nQueryRowxContext using this statement. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) Queryx(args ...interface{}) (*Rows, error)\n```\nQueryx using this statement. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) QueryxContext(ctx context.Context, args ...interface{}) (*Rows, error)\n```\nQueryxContext using this statement. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) Select(dest interface{}, args ...interface{}) error\n```\nSelect using the prepared statement. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) SelectContext(ctx context.Context, dest interface{}, args ...interface{}) error\n```\nSelectContext using the prepared statement. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (s *Stmt) Unsafe() *Stmt\n```\nUnsafe returns a version of Stmt which will silently succeed to scan when columns in the SQL result have no fields in the destination struct.\n\n```go\ntype Tx struct {\n\t*sql.Tx\n\n\tMapper *reflectx.Mapper\n\t// contains filtered or unexported fields\n}\n```\nTx is an sqlx wrapper around sql.Tx with extra functionality\n\n```go\nfunc NewTx(tx *sql.Tx, driverName string) *Tx\n```\n\n```go\nfunc (tx *Tx) BindNamed(query string, arg interface{}) (string, []interface{}, error)\n```\nBindNamed binds a query within a transaction's bindvar type.\n\n```go\nfunc (tx *Tx) DriverName() string\n```\nDriverName returns the driverName used by the DB which began this transaction.\n\n```go\nfunc (tx *Tx) Get(dest interface{}, query string, args ...interface{}) error\n```\nGet within a transaction. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.\n\n```go\nfunc (tx *Tx) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\nGetContext within a transaction and context. Any placeholder parameters are replaced with supplied args. An error is returned if the result set is empty.\n\n```go\nfunc (tx *Tx) MustExec(query string, args ...interface{}) sql.Result\n```\nMustExec runs MustExec within a transaction. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) MustExecContext(ctx context.Context, query string, args ...interface{}) sql.Result\n```\nMustExecContext runs MustExecContext within a transaction. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) NamedExec(query string, arg interface{}) (sql.Result, error)\n```\nNamedExec a named query within a transaction. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (tx *Tx) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)\n```\nNamedExecContext using this Tx. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (tx *Tx) NamedQuery(query string, arg interface{}) (*Rows, error)\n```\nNamedQuery within a transaction. Any named placeholder parameters are replaced with fields from arg.\n\n```go\nfunc (tx *Tx) NamedStmt(stmt *NamedStmt) *NamedStmt\n```\nNamedStmt returns a version of the prepared statement which runs within a transaction.\n\n```go\nfunc (tx *Tx) NamedStmtContext(ctx context.Context, stmt *NamedStmt) *NamedStmt\n```\nNamedStmtContext returns a version of the prepared statement which runs within a transaction.\n\n```go\nfunc (tx *Tx) PrepareNamed(query string) (*NamedStmt, error)\n```\nPrepareNamed returns an sqlx.NamedStmt\n\n```go\nfunc (tx *Tx) PrepareNamedContext(ctx context.Context, query string) (*NamedStmt, error)\n```\nPrepareNamedContext returns an sqlx.NamedStmt\n\n```go\nfunc (tx *Tx) Preparex(query string) (*Stmt, error)\n```\nPreparex  a statement within a transaction.\n\n```go\nfunc (tx *Tx) PreparexContext(ctx context.Context, query string) (*Stmt, error)\n```\nPreparexContext returns an sqlx.Stmt instead of a sql.Stmt.\n\nThe provided context is used for the preparation of the statement, not for the execution of the statement.\n\n```go\nfunc (tx *Tx) QueryRowx(query string, args ...interface{}) *Row\n```\nQueryRowx within a transaction. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) QueryRowxContext(ctx context.Context, query string, args ...interface{}) *Row\n```\nQueryRowxContext within a transaction and context. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) Queryx(query string, args ...interface{}) (*Rows, error)\n```\nQueryx within a transaction. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) QueryxContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)\n```\nQueryxContext within a transaction and context. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) Rebind(query string) string\n```\nRebind a query within a transaction's bindvar type.\n\n```go\nfunc (tx *Tx) Select(dest interface{}, query string, args ...interface{}) error\n```\nSelect within a transaction. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error\n```\nSelectContext within a transaction and context. Any placeholder parameters are replaced with supplied args.\n\n```go\nfunc (tx *Tx) Stmtx(stmt interface{}) *Stmt\n```\nStmtx returns a version of the prepared statement which runs within a transaction.  Provided stmt can be either \\*sql.Stmt or \\*sqlx.Stmt.\n\n```go\nfunc (tx *Tx) StmtxContext(ctx context.Context, stmt interface{}) *Stmt\n```\nStmtxContext returns a version of the prepared statement which runs within a transaction. Provided stmt can be either \\*sql.Stmt or \\*sqlx.Stmt.\n\n```go\nfunc (tx *Tx) Unsafe() *Tx\n```\nUnsafe returns a version of Tx which will silently succeed to scan when columns in the SQL result have no fields in the destination struct.\n\n","path":"github.com/smartcontractkit/sqlx","name":"sqlx","synopsis":"Package sqlx provides general purpose extensions to database/sql.","isRedistributable":true}
