Documentation ¶
Index ¶
- type Begin
- type Column
- type Commit
- type DMLHandlerStatus
- type DecoderValue
- type Delete
- type EventType
- type Insert
- type Message
- type Origin
- type Relation
- type RelationSet
- type ReplicaIdentity
- type Replication
- func (t *Replication) Close()
- func (t *Replication) CreatePublication(tables []string) error
- func (t *Replication) CreateReplication() (err error)
- func (t *Replication) Debug() *Replication
- func (t *Replication) DropPublication() error
- func (t *Replication) DropReplication() error
- func (t *Replication) SendStatusACK(lsn uint64) error
- func (t *Replication) SetReplicaIdentity(tables []string, status ReplicaIdentity) (err error)
- func (t *Replication) Start(ctx context.Context, dmlHandler ReplicationDMLHandler) (err error)
- type ReplicationDMLHandler
- type ReplicationMessage
- type Truncate
- type Tuple
- type Type
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DMLHandlerStatus ¶ added in v1.0.0
type DMLHandlerStatus int
const ( DMLHandlerStatusSuccess DMLHandlerStatus = 0 //wal lsn游标将会变动 DMLHandlerStatusContinue DMLHandlerStatus = 1 //wal lsn游标不会变动 )
type DecoderValue ¶
type DecoderValue interface { pgtype.TextDecoder pgtype.Value }
type RelationSet ¶
type RelationSet struct {
// contains filtered or unexported fields
}
func NewRelationSet ¶
func NewRelationSet() *RelationSet
func (*RelationSet) Add ¶
func (rs *RelationSet) Add(r Relation)
func (*RelationSet) Assist ¶
func (rs *RelationSet) Assist(id uint32) (schema, table string)
type ReplicaIdentity ¶ added in v1.1.3
type ReplicaIdentity string
表复制标识枚举
const ( // ReplicaIdentityFull // 需要开启replica identity full权限的表 // 逻辑复制-更改复制标识 // 默认情况下,复制标识就是主键(如果有主键)。 // 也可以在复制标识上设置另一个唯一索引(有特定的额外要求)。 // 如果表没有合适的键,那么可以设置成复制标识“full”,它表示整个行都成为那个键。 // 不过,这样做效率很低,只有在没有其他方案的情况下才应该使用。 ReplicaIdentityFull ReplicaIdentity = "FULL" // ReplicaIdentityDefault // 默认按照主键id为复制标识 // update时无法得知详细更新column信息 ReplicaIdentityDefault ReplicaIdentity = "DEFAULT" )
type Replication ¶ added in v1.1.5
type Replication struct {
// contains filtered or unexported fields
}
func NewReplication ¶ added in v1.1.5
func NewReplication(name string, config pgx.ConnConfig) *Replication
func (*Replication) Close ¶ added in v1.1.5
func (t *Replication) Close()
func (*Replication) CreatePublication ¶ added in v1.1.5
func (t *Replication) CreatePublication(tables []string) error
CreatePublication 移除复制槽
func (*Replication) CreateReplication ¶ added in v1.1.5
func (t *Replication) CreateReplication() (err error)
CreateReplication 创建逻辑复制槽 锁定起始lsn位置
func (*Replication) Debug ¶ added in v1.1.5
func (t *Replication) Debug() *Replication
func (*Replication) DropPublication ¶ added in v1.1.5
func (t *Replication) DropPublication() error
DropPublication 移除复制槽
func (*Replication) DropReplication ¶ added in v1.1.5
func (t *Replication) DropReplication() error
DropReplication 移除复制槽
func (*Replication) SendStatusACK ¶ added in v1.1.5
func (t *Replication) SendStatusACK(lsn uint64) error
SendStatusACK 向master发送lsn,即:WAL中使用者已经收到解码数据的最新位置 详见:select * from pg_catalog.pg_replication_slots;结果中的confirmed_flush_lsn
func (*Replication) SetReplicaIdentity ¶ added in v1.1.5
func (t *Replication) SetReplicaIdentity(tables []string, status ReplicaIdentity) (err error)
SetReplicaIdentity 配置表复制标识
func (*Replication) Start ¶ added in v1.1.5
func (t *Replication) Start(ctx context.Context, dmlHandler ReplicationDMLHandler) (err error)
type ReplicationDMLHandler ¶
type ReplicationDMLHandler func(msg ...ReplicationMessage) DMLHandlerStatus
type ReplicationMessage ¶
Click to show internal directories.
Click to hide internal directories.