Documentation
¶
Index ¶
- Variables
- func DefaultReplicationSlotName(dbName string) string
- func RunPGDump(opts PGDumpOptions) ([]byte, error)
- func RunPGRestore(opts PGRestoreOptions, dump []byte) (string, error)
- type CommandTag
- type Conn
- func (c *Conn) Close(ctx context.Context) error
- func (c *Conn) Exec(ctx context.Context, query string, args ...any) (CommandTag, error)
- func (c *Conn) ExecInTx(ctx context.Context, fn func(Tx) error) error
- func (c *Conn) ExecInTxWithOptions(ctx context.Context, fn func(Tx) error, opts TxOptions) error
- func (c *Conn) Query(ctx context.Context, query string, args ...any) (Rows, error)
- func (c *Conn) QueryRow(ctx context.Context, query string, args ...any) Row
- type ErrConstraintViolation
- type ErrDataException
- type ErrRelationDoesNotExist
- type ErrSyntaxError
- type Error
- type IdentifySystemResult
- type Mapper
- type PGDumpOptions
- type PGRestoreOptions
- type Pool
- func (c *Pool) Close(_ context.Context) error
- func (c *Pool) Exec(ctx context.Context, query string, args ...any) (CommandTag, error)
- func (c *Pool) ExecInTx(ctx context.Context, fn func(Tx) error) error
- func (c *Pool) ExecInTxWithOptions(ctx context.Context, fn func(Tx) error, opts TxOptions) error
- func (c *Pool) Query(ctx context.Context, query string, args ...any) (Rows, error)
- func (c *Pool) QueryRow(ctx context.Context, query string, args ...any) Row
- type Querier
- type QuerierBuilder
- type ReplicationConfig
- type ReplicationConn
- func (c *ReplicationConn) Close(ctx context.Context) error
- func (c *ReplicationConn) IdentifySystem(ctx context.Context) (IdentifySystemResult, error)
- func (c *ReplicationConn) ReceiveMessage(ctx context.Context) (*ReplicationMessage, error)
- func (c *ReplicationConn) SendStandbyStatusUpdate(ctx context.Context, lsn uint64) error
- func (c *ReplicationConn) StartReplication(ctx context.Context, cfg ReplicationConfig) error
- type ReplicationMessage
- type Row
- type Rows
- type Tx
- type TxAccessMode
- type TxIsolationLevel
- type TxOptions
- type Txn
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConnTimeout = errors.New("connection timeout") ErrNoRows = errors.New("no rows") )
View Source
var ErrUnsupportedCopyDataMessage = errors.New("unsupported copy data message")
Functions ¶
func DefaultReplicationSlotName ¶ added in v0.3.0
func RunPGDump ¶ added in v0.4.0
func RunPGDump(opts PGDumpOptions) ([]byte, error)
Func RunPGDump runs pg_dump command with the given options and returns the result.
func RunPGRestore ¶ added in v0.4.0
func RunPGRestore(opts PGRestoreOptions, dump []byte) (string, error)
Func RunPGRestore runs pg_restore command with the given options and returns the result.
Types ¶
type CommandTag ¶
type CommandTag struct {
pgconn.CommandTag
}
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) ExecInTxWithOptions ¶ added in v0.3.0
type ErrConstraintViolation ¶ added in v0.4.0
type ErrConstraintViolation struct {
Details string
}
func (*ErrConstraintViolation) Error ¶ added in v0.4.0
func (e *ErrConstraintViolation) Error() string
type ErrDataException ¶ added in v0.4.1
type ErrDataException struct {
Details string
}
func (*ErrDataException) Error ¶ added in v0.4.1
func (e *ErrDataException) Error() string
type ErrRelationDoesNotExist ¶ added in v0.4.0
type ErrRelationDoesNotExist struct {
Details string
}
func (*ErrRelationDoesNotExist) Error ¶ added in v0.4.0
func (e *ErrRelationDoesNotExist) Error() string
type ErrSyntaxError ¶ added in v0.4.0
type ErrSyntaxError struct {
Details string
}
func (*ErrSyntaxError) Error ¶ added in v0.4.0
func (e *ErrSyntaxError) Error() string
type IdentifySystemResult ¶
type IdentifySystemResult pglogrepl.IdentifySystemResult
type Mapper ¶ added in v0.3.0
type Mapper struct {
// contains filtered or unexported fields
}
func (*Mapper) TypeForOID ¶ added in v0.3.0
type PGDumpOptions ¶ added in v0.4.0
type PGDumpOptions struct {
// ConnectionString
ConnectionString string
// Format (c custom, d directory, t tar, p plain text)
Format string
// Schemas to export
Schemas []string
// Tables to export
Tables []string
// Tables to be excluded from the dump, regex patterns supported
ExcludeTables []string
// SchemaOnly if true, only schema will be exported (no data)
SchemaOnly bool
// do not dump privileges (grant/revoke)
NoPrivileges bool
// Options to pass to pg_dump
Options []string
}
func (*PGDumpOptions) ToArgs ¶ added in v0.4.0
func (opts *PGDumpOptions) ToArgs() []string
type PGRestoreOptions ¶ added in v0.4.0
type PGRestoreOptions struct {
// ConnectionString
ConnectionString string
// SchemaOnly if true, only schema will be restored (no data)
SchemaOnly bool
// Clean all the objects that will be restored
Clean bool
// Options to pass to pg_restore
Options []string
}
func (PGRestoreOptions) ToArgs ¶ added in v0.4.0
func (opts PGRestoreOptions) ToArgs() []string
type Pool ¶
func (*Pool) ExecInTxWithOptions ¶ added in v0.3.0
type Querier ¶
type Querier interface {
Query(ctx context.Context, query string, args ...any) (Rows, error)
QueryRow(ctx context.Context, query string, args ...any) Row
Exec(ctx context.Context, query string, args ...any) (CommandTag, error)
ExecInTx(ctx context.Context, fn func(tx Tx) error) error
ExecInTxWithOptions(ctx context.Context, fn func(tx Tx) error, txOpts TxOptions) error
Close(ctx context.Context) error
}
func ConnBuilder ¶ added in v0.4.1
type QuerierBuilder ¶ added in v0.4.1
type ReplicationConfig ¶
type ReplicationConn ¶
type ReplicationConn struct {
// contains filtered or unexported fields
}
func NewReplicationConn ¶
func NewReplicationConn(ctx context.Context, url string) (*ReplicationConn, error)
func (*ReplicationConn) IdentifySystem ¶
func (c *ReplicationConn) IdentifySystem(ctx context.Context) (IdentifySystemResult, error)
func (*ReplicationConn) ReceiveMessage ¶
func (c *ReplicationConn) ReceiveMessage(ctx context.Context) (*ReplicationMessage, error)
func (*ReplicationConn) SendStandbyStatusUpdate ¶
func (c *ReplicationConn) SendStandbyStatusUpdate(ctx context.Context, lsn uint64) error
func (*ReplicationConn) StartReplication ¶
func (c *ReplicationConn) StartReplication(ctx context.Context, cfg ReplicationConfig) error
type ReplicationMessage ¶
type TxAccessMode ¶ added in v0.3.0
type TxAccessMode string
const ( ReadWrite TxAccessMode = "read write" ReadOnly TxAccessMode = "read only" )
type TxIsolationLevel ¶ added in v0.3.0
type TxIsolationLevel string
const ( Serializable TxIsolationLevel = "serializable" RepeatableRead TxIsolationLevel = "repeatable read" ReadCommitted TxIsolationLevel = "read committed" ReadUncommitted TxIsolationLevel = "read uncommitted" )
type TxOptions ¶ added in v0.3.0
type TxOptions struct {
IsolationLevel TxIsolationLevel
AccessMode TxAccessMode
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.