publication

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReplicaIdentityFull    = "FULL"
	ReplicaIdentityDefault = "DEFAULT"
)

Variables

View Source
var (
	ErrorTablesNotExists   = goerrors.New("table is not exists")
	ReplicaIdentityOptions = []string{ReplicaIdentityDefault, ReplicaIdentityFull}
	ReplicaIdentityMap     = map[string]string{
		"d": ReplicaIdentityDefault,
		"f": ReplicaIdentityFull,
	}
)
View Source
var (
	ErrorPublicationIsNotExists = goerrors.New("publication is not exists")
)
View Source
var OperationOptions = Operations{"INSERT", "UPDATE", "DELETE", "TRUNCATE"}

Functions

This section is empty.

Types

type Config

type Config struct {
	Name              string     `json:"name" yaml:"name"`
	Operations        Operations `json:"operations" yaml:"operations"`
	Tables            Tables     `json:"tables" yaml:"tables"`
	CreateIfNotExists bool       `json:"createIfNotExists" yaml:"createIfNotExists"`
}

func (Config) Validate

func (c Config) Validate() error

type Operation

type Operation string
var (
	OperationInsert   Operation = "INSERT"
	OperationUpdate   Operation = "UPDATE"
	OperationDelete   Operation = "DELETE"
	OperationTruncate Operation = "TRUNCATE"
)

func (Operation) Validate

func (op Operation) Validate() error

type Operations

type Operations []Operation

func (Operations) String

func (ops Operations) String() string

func (Operations) Validate

func (ops Operations) Validate() error

type Publication

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

func New

func New(cfg Config, conn pq.Connection) *Publication

func (*Publication) AlterTableReplicaIdentity

func (c *Publication) AlterTableReplicaIdentity(ctx context.Context, t Table) error

func (*Publication) Create

func (c *Publication) Create(ctx context.Context) (*Config, error)

func (*Publication) GetReplicaIdentities

func (c *Publication) GetReplicaIdentities(ctx context.Context) ([]Table, error)

func (*Publication) Info

func (c *Publication) Info(ctx context.Context) (*Config, error)

func (*Publication) SetReplicaIdentities

func (c *Publication) SetReplicaIdentities(ctx context.Context) error

type Table

type Table struct {
	Name            string `json:"name" yaml:"name"`
	ReplicaIdentity string `json:"replicaIdentity" yaml:"replicaIdentity"`
}

func (Table) Validate

func (tc Table) Validate() error

type Tables

type Tables []Table

func (Tables) Diff

func (ts Tables) Diff(tss Tables) Tables

func (Tables) Validate

func (ts Tables) Validate() error

Jump to

Keyboard shortcuts

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