db

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionKind

type ActionKind string

ActionKind is the kind of RowAction

const (
	Insert ActionKind = "INSERT"
	Update ActionKind = "UPDATE"
	Delete ActionKind = "DELETE"
)

type Column

type Column struct {
	Name       string
	ValueType  uint32
	IsIdentity bool
	IsArray    bool
}

type Relation

type Relation struct {
	Schema  string
	Table   string
	Columns []Column
}

func (*Relation) ColumnNames

func (r *Relation) ColumnNames() []string

func (*Relation) Equal

func (r *Relation) Equal(r2 *Relation) bool

func (*Relation) IdentityColumnIndices

func (r *Relation) IdentityColumnIndices() []int

func (*Relation) IdentityColumnNames

func (r *Relation) IdentityColumnNames() []string

func (*Relation) IdentityColumns

func (r *Relation) IdentityColumns() []Column

func (*Relation) NotIdentityColumns

func (r *Relation) NotIdentityColumns() []Column

type RowAction

type RowAction struct {
	*Relation
	Kind               ActionKind
	ChangesRowIdentity bool
	RowIdentityBefore  []*Value
	NewValues          []*Value
}

RowAction records a change to a row Kind identifies the type of change (INSERT, UPDATE, DELETE) ChangesRowIdentity is set true when postgres reports that an UPDATE has changed the row identity (key) RowIdentityBefore and NewValues are both arrays of values, the length of these arrays must be equal to the number of columns in the Relation. RowIdentityBefore holds the row identity values for the row before this action.

Non-identity columns are set to nil.

NewValues holds the values for the row after this action. It is nil for DELETE actions.

func (*RowAction) AfterActionRowIdentity

func (a *RowAction) AfterActionRowIdentity() string

func (*RowAction) BeforeActionRowIdentity

func (a *RowAction) BeforeActionRowIdentity() string

func (*RowAction) String

func (a *RowAction) String() string

type Value

type Value struct {
	V    string
	Null bool
	// Values that are TOASTed are not sent when they are unchanged, instead this flag is set.
	// The other columns of the row should be updated but this value should remain unchanged.
	Unchanged bool
}

func Map

func Map(vs []*Value, f func(int, *Value) *Value) []*Value

type WalTransaction

type WalTransaction struct {
	LSN        pglogrepl.LSN
	BeginTime  *time.Time
	CommitTime *time.Time
	Actions    []*RowAction
}

WalTransaction transaction specified WAL message.

Jump to

Keyboard shortcuts

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