Versions in this module Expand all Collapse all v5 v5.3.1 Oct 30, 2024 Changes in this version + const ConnectionId + const SharedMemoryKey + const TargetUrl + const Token + const TsUrl + func AEParameter(c *Conn, paraName string) string type Conn + func (c *Conn) GetColumnsValue() []string + type KwConn struct + ConnectionId string + Kwbase *Conn + SharedMemoryKey string + TargetUrl string + Token string + Ts *Conn + TsUrl string + func KwConnect(ctx context.Context, connInfo string) (*KwConn, error) + func (c *KwConn) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) v5.2.0 Nov 5, 2024 Changes in this version + const BinaryFormatCode + const TextFormatCode + var ErrNoRows = errors.New("no rows in result set") + var ErrTxClosed = errors.New("tx is closed") + var ErrTxCommitRollback = errors.New("commit unexpectedly resulted in rollback") + func BeginFunc(ctx context.Context, db interface{ ... }, fn func(Tx) error) (err error) + func BeginTxFunc(ctx context.Context, db interface{ ... }, txOptions TxOptions, ...) (err error) + func CollectOneRow[T any](rows Rows, fn RowToFunc[T]) (T, error) + func CollectRows[T any](rows Rows, fn RowToFunc[T]) ([]T, error) + func ForEachRow(rows Rows, scans []any, fn func() error) (pgconn.CommandTag, error) + func RowToAddrOfStructByName[T any](row CollectableRow) (*T, error) + func RowToAddrOfStructByPos[T any](row CollectableRow) (*T, error) + func RowToAddrOf[T any](row CollectableRow) (*T, error) + func RowToMap(row CollectableRow) (map[string]any, error) + func RowToStructByName[T any](row CollectableRow) (T, error) + func RowToStructByPos[T any](row CollectableRow) (T, error) + func RowTo[T any](row CollectableRow) (T, error) + func ScanRow(typeMap *pgtype.Map, fieldDescriptions []pgconn.FieldDescription, ...) error + type Batch struct + func (b *Batch) Len() int + func (b *Batch) Queue(query string, arguments ...any) *QueuedQuery + type BatchResults interface + Close func() error + Exec func() (pgconn.CommandTag, error) + Query func() (Rows, error) + QueryRow func() Row + type BatchTracer interface + TraceBatchEnd func(ctx context.Context, conn *Conn, data TraceBatchEndData) + TraceBatchQuery func(ctx context.Context, conn *Conn, data TraceBatchQueryData) + TraceBatchStart func(ctx context.Context, conn *Conn, data TraceBatchStartData) context.Context + type CollectableRow interface + FieldDescriptions func() []pgconn.FieldDescription + RawValues func() [][]byte + Scan func(dest ...any) error + Values func() ([]any, error) + type Conn struct + func Connect(ctx context.Context, connString string) (*Conn, error) + func ConnectConfig(ctx context.Context, connConfig *ConnConfig) (*Conn, error) + func ConnectWithOptions(ctx context.Context, connString string, options ParseConfigOptions) (*Conn, error) + func (c *Conn) Begin(ctx context.Context) (Tx, error) + func (c *Conn) BeginTx(ctx context.Context, txOptions TxOptions) (Tx, error) + func (c *Conn) Close(ctx context.Context) error + func (c *Conn) Config() *ConnConfig + func (c *Conn) CopyFrom(ctx context.Context, tableName Identifier, columnNames []string, ...) (int64, error) + func (c *Conn) Deallocate(ctx context.Context, name string) error + func (c *Conn) DeallocateAll(ctx context.Context) error + func (c *Conn) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) + func (c *Conn) IsClosed() bool + func (c *Conn) LoadType(ctx context.Context, typeName string) (*pgtype.Type, error) + func (c *Conn) PgConn() *pgconn.PgConn + func (c *Conn) Ping(ctx context.Context) error + func (c *Conn) Prepare(ctx context.Context, name, sql string) (sd *pgconn.StatementDescription, err error) + func (c *Conn) Query(ctx context.Context, sql string, args ...any) (Rows, error) + func (c *Conn) QueryRow(ctx context.Context, sql string, args ...any) Row + func (c *Conn) SendBatch(ctx context.Context, b *Batch) (br BatchResults) + func (c *Conn) TypeMap() *pgtype.Map + func (c *Conn) WaitForNotification(ctx context.Context) (*pgconn.Notification, error) + type ConnConfig struct + DefaultQueryExecMode QueryExecMode + DescriptionCacheCapacity int + StatementCacheCapacity int + Tracer QueryTracer + func ParseConfig(connString string) (*ConnConfig, error) + func ParseConfigWithOptions(connString string, options ParseConfigOptions) (*ConnConfig, error) + func (cc *ConnConfig) ConnString() string + func (cc *ConnConfig) Copy() *ConnConfig + type ConnectTracer interface + TraceConnectEnd func(ctx context.Context, data TraceConnectEndData) + TraceConnectStart func(ctx context.Context, data TraceConnectStartData) context.Context + type CopyFromSource interface + Err func() error + Next func() bool + Values func() ([]any, error) + func CopyFromRows(rows [][]any) CopyFromSource + func CopyFromSlice(length int, next func(int) ([]any, error)) CopyFromSource + type CopyFromTracer interface + TraceCopyFromEnd func(ctx context.Context, conn *Conn, data TraceCopyFromEndData) + TraceCopyFromStart func(ctx context.Context, conn *Conn, data TraceCopyFromStartData) context.Context + type ExtendedQueryBuilder struct + ParamFormats []int16 + ParamValues [][]byte + ResultFormats []int16 + func (eqb *ExtendedQueryBuilder) Build(m *pgtype.Map, sd *pgconn.StatementDescription, args []any) error + type Identifier []string + func (ident Identifier) Sanitize() string + type LargeObject struct + func (o *LargeObject) Close() error + func (o *LargeObject) Read(p []byte) (int, error) + func (o *LargeObject) Seek(offset int64, whence int) (n int64, err error) + func (o *LargeObject) Tell() (n int64, err error) + func (o *LargeObject) Truncate(size int64) (err error) + func (o *LargeObject) Write(p []byte) (int, error) + type LargeObjectMode int32 + const LargeObjectModeRead + const LargeObjectModeWrite + type LargeObjects struct + func (o *LargeObjects) Create(ctx context.Context, oid uint32) (uint32, error) + func (o *LargeObjects) Open(ctx context.Context, oid uint32, mode LargeObjectMode) (*LargeObject, error) + func (o *LargeObjects) Unlink(ctx context.Context, oid uint32) error + type NamedArgs map[string]any + func (na NamedArgs) RewriteQuery(ctx context.Context, conn *Conn, sql string, args []any) (newSQL string, newArgs []any, err error) + type ParseConfigOptions struct + type PrepareTracer interface + TracePrepareEnd func(ctx context.Context, conn *Conn, data TracePrepareEndData) + TracePrepareStart func(ctx context.Context, conn *Conn, data TracePrepareStartData) context.Context + type QueryExecMode int32 + const QueryExecModeBindExec + const QueryExecModeCacheDescribe + const QueryExecModeCacheStatement + const QueryExecModeDescribeExec + const QueryExecModeExec + const QueryExecModeSimpleProtocol + func (m QueryExecMode) String() string + type QueryResultFormats []int16 + type QueryResultFormatsByOID map[uint32]int16 + type QueryRewriter interface + RewriteQuery func(ctx context.Context, conn *Conn, sql string, args []any) (newSQL string, newArgs []any, err error) + type QueryTracer interface + TraceQueryEnd func(ctx context.Context, conn *Conn, data TraceQueryEndData) + TraceQueryStart func(ctx context.Context, conn *Conn, data TraceQueryStartData) context.Context + type QueuedQuery struct + func (qq *QueuedQuery) Exec(fn func(ct pgconn.CommandTag) error) + func (qq *QueuedQuery) Query(fn func(rows Rows) error) + func (qq *QueuedQuery) QueryRow(fn func(row Row) error) + type Row interface + Scan func(dest ...any) error + type RowScanner interface + ScanRow func(rows Rows) error + type RowToFunc func(row CollectableRow) (T, error) + type Rows interface + Close func() + CommandTag func() pgconn.CommandTag + Conn func() *Conn + Err func() error + FieldDescriptions func() []pgconn.FieldDescription + Next func() bool + RawValues func() [][]byte + Scan func(dest ...any) error + Values func() ([]any, error) + func RowsFromResultReader(typeMap *pgtype.Map, resultReader *pgconn.ResultReader) Rows + type ScanArgError struct + ColumnIndex int + Err error + func (e ScanArgError) Error() string + func (e ScanArgError) Unwrap() error + type TraceBatchEndData struct + Err error + type TraceBatchQueryData struct + Args []any + CommandTag pgconn.CommandTag + Err error + SQL string + type TraceBatchStartData struct + Batch *Batch + type TraceConnectEndData struct + Conn *Conn + Err error + type TraceConnectStartData struct + ConnConfig *ConnConfig + type TraceCopyFromEndData struct + CommandTag pgconn.CommandTag + Err error + type TraceCopyFromStartData struct + ColumnNames []string + TableName Identifier + type TracePrepareEndData struct + AlreadyPrepared bool + Err error + type TracePrepareStartData struct + Name string + SQL string + type TraceQueryEndData struct + CommandTag pgconn.CommandTag + Err error + type TraceQueryStartData struct + Args []any + SQL string + type Tx interface + Begin func(ctx context.Context) (Tx, error) + Commit func(ctx context.Context) error + Conn func() *Conn + CopyFrom func(ctx context.Context, tableName Identifier, columnNames []string, ...) (int64, error) + Exec func(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error) + LargeObjects func() LargeObjects + Prepare func(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error) + Query func(ctx context.Context, sql string, args ...any) (Rows, error) + QueryRow func(ctx context.Context, sql string, args ...any) Row + Rollback func(ctx context.Context) error + SendBatch func(ctx context.Context, b *Batch) BatchResults + type TxAccessMode string + const ReadOnly + const ReadWrite + type TxDeferrableMode string + const Deferrable + const NotDeferrable + type TxIsoLevel string + const ReadCommitted + const ReadUncommitted + const RepeatableRead + const Serializable + type TxOptions struct + AccessMode TxAccessMode + DeferrableMode TxDeferrableMode + IsoLevel TxIsoLevel