Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Operation
- type Operations
- type Option
- type Publication
- func (p *Publication) AddTable(ctx context.Context, table Table) error
- func (p *Publication) AlterTableReplicaIdentity(ctx context.Context, t Table) error
- func (p *Publication) Create(ctx context.Context) (*Config, error)
- func (p *Publication) GetReplicaIdentities(ctx context.Context) ([]Table, error)
- func (p *Publication) Info(ctx context.Context) (*Config, error)
- func (p *Publication) RemoveTable(ctx context.Context, table Table) error
- func (p *Publication) SetReplicaIdentities(ctx context.Context) error
- type Table
- type TableOption
- type Tables
Constants ¶
View Source
const ( ReplicaIdentityDefault = "DEFAULT" ReplicaIdentityFull = "FULL" ReplicaIdentityIndex = "INDEX" ReplicaIdentityNothing = "NOTHING" )
Variables ¶
View Source
var ( ErrTablesNotExist = errors.New("table does not exist") ReplicaIdentityOptions = []string{ReplicaIdentityDefault, ReplicaIdentityFull, ReplicaIdentityIndex, ReplicaIdentityNothing} ReplicaIdentityMap = map[string]string{ "d": ReplicaIdentityDefault, "f": ReplicaIdentityFull, "i": ReplicaIdentityIndex, "n": ReplicaIdentityNothing, } )
View Source
var ErrPublicationNotExists = errors.New("publication does not exist")
View Source
var OperationOptions = Operations{"INSERT", "UPDATE", "DELETE", "TRUNCATE"}
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string
Operations Operations
Tables Tables
CreateIfNotExists bool
}
type Operations ¶
type Operations []Operation
func (Operations) String ¶
func (ops Operations) String() string
func (Operations) Validate ¶
func (ops Operations) Validate() error
type Option ¶
type Option func(*Config)
func WithCreateIfNotExists ¶
func WithOperations ¶
func WithOperations(operations Operations) Option
func WithTables ¶
type Publication ¶
type Publication struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg Config, conn pg.Connection) *Publication
func (*Publication) AddTable ¶
func (p *Publication) AddTable(ctx context.Context, table Table) error
func (*Publication) AlterTableReplicaIdentity ¶
func (p *Publication) AlterTableReplicaIdentity(ctx context.Context, t Table) error
func (*Publication) GetReplicaIdentities ¶
func (p *Publication) GetReplicaIdentities(ctx context.Context) ([]Table, error)
func (*Publication) RemoveTable ¶
func (p *Publication) RemoveTable(ctx context.Context, table Table) error
func (*Publication) SetReplicaIdentities ¶
func (p *Publication) SetReplicaIdentities(ctx context.Context) error
type TableOption ¶
type TableOption func(*Table)
func WithIndexName ¶
func WithIndexName(indexName string) TableOption
func WithReplicaIdentity ¶
func WithReplicaIdentity(replicaIdentity string) TableOption
func WithSchema ¶
func WithSchema(schema string) TableOption
Click to show internal directories.
Click to hide internal directories.