driver

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PgTypeBool             = 16
	PgTypeBytea            = 17
	PgTypeChar             = 18
	PgTypeName             = 19
	PgTypeInt8             = 20
	PgTypeInt2             = 21
	PgTypeInt2vector       = 22
	PgTypeInt4             = 23
	PgTypeRegproc          = 24
	PgTypeText             = 25
	PgTypeOid              = 26
	PgTypeTid              = 27
	PgTypeXid              = 28
	PgTypeCid              = 29
	PgTypeOidvector        = 30
	PgTypePgDdlCommand     = 32
	PgTypePgType           = 71
	PgTypePgAttribute      = 75
	PgTypePgProc           = 81
	PgTypePgClass          = 83
	PgTypeJson             = 114
	PgTypeXml              = 142
	PgTypeArrXml           = 143
	PgTypePgNodeTree       = 194
	PgTypeArrJson          = 199
	PgTypeSmgr             = 210
	PgTypeIndexAmHandler   = 325
	PgTypePoint            = 600
	PgTypeLseg             = 601
	PgTypePath             = 602
	PgTypeBox              = 603
	PgTypePolygon          = 604
	PgTypeLine             = 628
	PgTypeArrLine          = 629
	PgTypeCidr             = 650
	PgTypeArrCidr          = 651
	PgTypeFloat4           = 700
	PgTypeFloat8           = 701
	PgTypeAbstime          = 702
	PgTypeReltime          = 703
	PgTypeTinterval        = 704
	PgTypeUnknown          = 705
	PgTypeCircle           = 718
	PgTypeArrCircle        = 719
	PgTypeMacaddr8         = 774
	PgTypeArrMacaddr8      = 775
	PgTypeMoney            = 790
	PgTypeArrMoney         = 791
	PgTypeMacaddr          = 829
	PgTypeInet             = 869
	PgTypeArrBool          = 1000
	PgTypeArrBytea         = 1001
	PgTypeArrChar          = 1002
	PgTypeArrName          = 1003
	PgTypeArrInt2          = 1005
	PgTypeArrInt2vector    = 1006
	PgTypeArrInt4          = 1007
	PgTypeArrRegproc       = 1008
	PgTypeArrText          = 1009
	PgTypeArrTid           = 1010
	PgTypeArrXid           = 1011
	PgTypeArrCid           = 1012
	PgTypeArrOidvector     = 1013
	PgTypeArrBpchar        = 1014
	PgTypeArrVarchar       = 1015
	PgTypeArrInt8          = 1016
	PgTypeArrPoint         = 1017
	PgTypeArrLseg          = 1018
	PgTypeArrPath          = 1019
	PgTypeArrBox           = 1020
	PgTypeArrFloat4        = 1021
	PgTypeArrFloat8        = 1022
	PgTypeArrAbstime       = 1023
	PgTypeArrReltime       = 1024
	PgTypeArrTinterval     = 1025
	PgTypeArrPolygon       = 1027
	PgTypeArrOid           = 1028
	PgTypeAclitem          = 1033
	PgTypeArrAclitem       = 1034
	PgTypeArrMacaddr       = 1040
	PgTypeArrInet          = 1041
	PgTypeBpchar           = 1042
	PgTypeVarchar          = 1043
	PgTypeDate             = 1082
	PgTypeTime             = 1083
	PgTypeTimestamp        = 1114
	PgTypeArrTimestamp     = 1115
	PgTypeArrDate          = 1182
	PgTypeArrTime          = 1183
	PgTypeTimestamptz      = 1184
	PgTypeArrTimestamptz   = 1185
	PgTypeInterval         = 1186
	PgTypeArrInterval      = 1187
	PgTypeArrNumeric       = 1231
	PgTypePgDatabase       = 1248
	PgTypeArrCstring       = 1263
	PgTypeTimetz           = 1266
	PgTypeArrTimetz        = 1270
	PgTypeBit              = 1560
	PgTypeArrBit           = 1561
	PgTypeVarbit           = 1562
	PgTypeArrVarbit        = 1563
	PgTypeNumeric          = 1700
	PgTypeRefcursor        = 1790
	PgTypeArrRefcursor     = 2201
	PgTypeRegprocedure     = 2202
	PgTypeRegoper          = 2203
	PgTypeRegoperator      = 2204
	PgTypeRegclass         = 2205
	PgTypeRegtype          = 2206
	PgTypeArrRegprocedure  = 2207
	PgTypeArrRegoper       = 2208
	PgTypeArrRegoperator   = 2209
	PgTypeArrRegclass      = 2210
	PgTypeArrRegtype       = 2211
	PgTypeRecord           = 2249
	PgTypeCstring          = 2275
	PgTypeAny              = 2276
	PgTypeAnyarray         = 2277
	PgTypeVoid             = 2278
	PgTypeTrigger          = 2279
	PgTypeLanguageHandler  = 2280
	PgTypeInternal         = 2281
	PgTypeOpaque           = 2282
	PgTypeAnyelement       = 2283
	PgTypeArrRecord        = 2287
	PgTypeAnynonarray      = 2776
	PgTypePgAuthid         = 2842
	PgTypePgAuthMembers    = 2843
	PgTypeArrTxidSnapshot  = 2949
	PgTypeUuid             = 2950
	PgTypeArrUuid          = 2951
	PgTypeTxidSnapshot     = 2970
	PgTypeFdwHandler       = 3115
	PgTypePgLsn            = 3220
	PgTypeArrPgLsn         = 3221
	PgTypeTsmHandler       = 3310
	PgTypePgNdistinct      = 3361
	PgTypePgDependencies   = 3402
	PgTypeAnyenum          = 3500
	PgTypeTsvector         = 3614
	PgTypeTsquery          = 3615
	PgTypeGtsvector        = 3642
	PgTypeArrTsvector      = 3643
	PgTypeArrGtsvector     = 3644
	PgTypeArrTsquery       = 3645
	PgTypeRegconfig        = 3734
	PgTypeArrRegconfig     = 3735
	PgTypeRegdictionary    = 3769
	PgTypeArrRegdictionary = 3770
	PgTypeJsonb            = 3802
	PgTypeArrJsonb         = 3807
	PgTypeAnyrange         = 3831
	PgTypeEventTrigger     = 3838
	PgTypeInt4range        = 3904
	PgTypeArrInt4range     = 3905
	PgTypeNumrange         = 3906
	PgTypeArrNumrange      = 3907
	PgTypeTsrange          = 3908
	PgTypeArrTsrange       = 3909
	PgTypeTstzrange        = 3910
	PgTypeArrTstzrange     = 3911
	PgTypeDaterange        = 3912
	PgTypeArrDaterange     = 3913
	PgTypeInt8range        = 3926
	PgTypeArrInt8range     = 3927
	PgTypePgShseclabel     = 4066
	PgTypeRegnamespace     = 4089
	PgTypeArrRegnamespace  = 4090
	PgTypeRegrole          = 4096
	PgTypeArrRegrole       = 4097
	PgTypePgSubscription   = 6101
)

Variables

View Source
var PgTypeMap = map[PgType]string{}/* 172 elements not displayed */

Functions

func ParseTimestamp

func ParseTimestamp(currentLocation *time.Location, str string) (time.Time, error)

ParseTimestamp parses Postgres' text format. It returns a time.Time in currentLocation iff that time's offset agrees with the offset sent from the Postgres server. Otherwise, ParseTimestamp returns a time.Time with the fixed offset offset provided by the Postgres server.

Types

type PgConn

type PgConn struct {
	// contains filtered or unexported fields
}

func NewPgConn

func NewPgConn(name string) (c PgConn, err error)

func NewPgConnContext

func NewPgConnContext(ctx context.Context, name string) (c *PgConn, err error)

func (PgConn) Begin

func (c PgConn) Begin() (_ driver.Tx, err error)

func (PgConn) BeginTx

func (c PgConn) BeginTx(ctx context.Context, opts driver.TxOptions) (tx driver.Tx, err error)

func (PgConn) CheckNamedValue

func (c PgConn) CheckNamedValue(nv *driver.NamedValue) error

CheckNamedValue NamedValueChecker可以可选地由Conn或Stmt实现。 它为驱动程序提供了更多控制来处理Go和数据库类型,超出了允许的默认值类型。

sql包按以下顺序检查值检查器,在第一个找到的匹配项处停止: Stmt.NamedValueChecker,Conn.NamedValueChecker,Stmt.ColumnConverter,DefaultParameterConverter。

如果CheckNamedValue返回ErrRemoveArgument,则NamedValue将不包含在最终查询参数中。 这可用于将特殊选项传递给查询本身。

如果返回ErrSkip,则会将列转换器错误检查路径用于参数。 司机可能希望在他们用完特殊情况后退回ErrSkip。

func (PgConn) Close

func (c PgConn) Close() (err error)

func (PgConn) ExecContext

func (c PgConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (res driver.Result, err error)

func (PgConn) Prepare

func (c PgConn) Prepare(query string) (driver.Stmt, error)

Prepare returns a prepared statement, bound to this connection.

func (PgConn) PrepareContext

func (c PgConn) PrepareContext(ctx context.Context, query string) (stmt driver.Stmt, err error)

func (PgConn) QueryContext

func (c PgConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (_ driver.Rows, err error)

type PgRows

type PgRows struct {
	// contains filtered or unexported fields
}

func (*PgRows) Close

func (pr *PgRows) Close() error

func (*PgRows) ColumnTypeDatabaseTypeName

func (pr *PgRows) ColumnTypeDatabaseTypeName(index int) string

func (*PgRows) ColumnTypeLength

func (pr *PgRows) ColumnTypeLength(index int) (length int64, ok bool)

func (*PgRows) ColumnTypePrecisionScale

func (pr *PgRows) ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool)

ColumnTypePrecisionScale may be implemented by Rows. It should return the precision and scale for decimal types. If not applicable, ok should be false.

func (*PgRows) ColumnTypeScanType

func (pr *PgRows) ColumnTypeScanType(index int) reflect.Type

func (*PgRows) Columns

func (pr *PgRows) Columns() (cols []string)

func (*PgRows) HasNextResultSet

func (pr *PgRows) HasNextResultSet() bool

HasNextResultSet is called at the end of the current result set and reports whether there is another result set after the current one.

func (*PgRows) Next

func (pr *PgRows) Next(dest []driver.Value) error

func (*PgRows) NextResultSet

func (pr *PgRows) NextResultSet() error

NextResultSet advances the driver to the next result set even if there are remaining rows in the current result set.

NextResultSet should return io.EOF when there are no more result sets.

type PgStmt

type PgStmt struct {
	client.Statement
	// contains filtered or unexported fields
}

func NewPgStmt

func NewPgStmt(client *client.Client, query string) (st PgStmt, err error)

func NewPgStmtContext

func NewPgStmtContext(ctx context.Context, client *client.Client, query string) (st PgStmt, err error)

func (PgStmt) Close

func (s PgStmt) Close() (err error)

func (PgStmt) Exec

func (s PgStmt) Exec(args []driver.Value) (res driver.Result, err error)

func (PgStmt) ExecContext

func (s PgStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)

ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE.

ExecContext must honor the context timeout and return when it is canceled.

func (PgStmt) NumInput

func (s PgStmt) NumInput() int

func (PgStmt) Query

func (s PgStmt) Query(args []driver.Value) (_ driver.Rows, err error)

func (PgStmt) QueryContext

func (s PgStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (_ driver.Rows, err error)

QueryContext executes a query that may return rows, such as a SELECT.

QueryContext must honor the context timeout and return when it is canceled.

type PgTx

type PgTx struct {
	// contains filtered or unexported fields
}

func (PgTx) Commit

func (t PgTx) Commit() (err error)

func (PgTx) Rollback

func (t PgTx) Rollback() (err error)

type PgType

type PgType uint32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL