Documentation ¶
Overview ¶
Package psql2 contains types supporting psql functions.
Index ¶
- func ExecValues(execResult sql.Result, e error) (ID, rows int64, err error)
- func NewExecResult(execResult sql.Result, e error) (result parl.ExecResult, err error)
- func QueryString(label string, ctx context.Context, dataSource parl.DataSource, query string, ...) (value string, err error)
- func ScanToInt(sqlRow *sql.Row, e error) (value int, err error)
- func ScanToString(sqlRow *sql.Row, e error) (value string, err error)
- type ExecResult
- type StatementCache
- type Stmt
- type StmtWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecValues ¶
ExecValues parses the result from an Exec* method into its values. if LastInsertId or RowsAffected fails, the error is added to err.
func NewExecResult ¶
func QueryString ¶
Types ¶
type ExecResult ¶
type ExecResult struct { ID int64 // last insert ID, 0 if none like UPDATE // contains filtered or unexported fields }
ExecResult makes sql.Result printable. sql.Result are obtained by invoking Exec* methods of sql.DB sql.Stmt sql.Conn sql.Tx. sql.Result is an interface with methods LastInsertId and RowsAffected. each driver provides an sql.Result implementation.
func (*ExecResult) Get ¶
func (r *ExecResult) Get() (ID int64, rows int64)
Get obtains last id and number of affected rows with errors separately
func (ExecResult) String ¶
func (r ExecResult) String() (s string)
type StatementCache ¶
type StatementCache struct { // the datasource containing SQL tables DataSource parl.DataSource // contains filtered or unexported fields }
StatementCache caches prepared statements for a data source
func NewStatementCache ¶
func NewStatementCache(dataSource parl.DataSource) (cache *StatementCache)
NewStatementCache returns a cache for prepared statements for a data source
func (*StatementCache) Close ¶
func (c *StatementCache) Close() (err error)
Close shuts down the statement cache