datasource

package
v0.0.0-...-d608ac7 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadDataSource

type ReadDataSource interface {
	GetTables(ctx context.Context) ([]db.Table, error)
	TableExists(table db.Table) bool
	GetSchemas(ctx context.Context) ([]string, error)
	GetTriggers(ctx context.Context, table string) ([]db.Trigger, error)
	StatusCheck(ctx context.Context) error
	GetNonDeferrableConstraints(ctx context.Context) ([]db.NonDeferrableConstraints, error)
	GetName() string
}

type ReadWriteDatasource

type ReadWriteDatasource struct {
	ReaderDataSource
}

func NewReadWriteDataSource

func NewReadWriteDataSource(Name string, Url string) (*ReadWriteDatasource, error)

func (*ReadWriteDatasource) CreateTempTable

func (rw *ReadWriteDatasource) CreateTempTable(ctx context.Context, name string, sourceTable string) error

func (*ReadWriteDatasource) DeleteAll

func (rw *ReadWriteDatasource) DeleteAll(ctx context.Context, table string) error

func (*ReadWriteDatasource) GetTempTableRowCount

func (rw *ReadWriteDatasource) GetTempTableRowCount(ctx context.Context, table string) (int64, error)

func (*ReadWriteDatasource) InsertFromTempTable

func (rw *ReadWriteDatasource) InsertFromTempTable(ctx context.Context, tempTable string, destTable string, sourceFields []string, destFields []string, onConflict string, action string) error

func (*ReadWriteDatasource) SetSequence

func (rw *ReadWriteDatasource) SetSequence(ctx context.Context, sequence string, value int) error

func (*ReadWriteDatasource) Truncate

func (rw *ReadWriteDatasource) Truncate(ctx context.Context, table string) error

type ReaderDataSource

type ReaderDataSource struct {
	Url    string
	DB     *pgx.Conn
	Name   string
	Tables []db.Table
	Debug  bool
}

func NewReadDataSource

func NewReadDataSource(Name string, Url string) (*ReaderDataSource, error)

func (*ReaderDataSource) GetColumns

func (r *ReaderDataSource) GetColumns(ctx context.Context) ([]db.Column, error)

func (*ReaderDataSource) GetName

func (r *ReaderDataSource) GetName() string

func (*ReaderDataSource) GetNonDeferrableConstraints

func (r *ReaderDataSource) GetNonDeferrableConstraints(ctx context.Context) ([]db.NonDeferrableConstraints, error)

func (*ReaderDataSource) GetPrimaryKeys

func (r *ReaderDataSource) GetPrimaryKeys(ctx context.Context) ([]db.PrimaryKey, error)

TODO handle pk order for multi column pks

func (*ReaderDataSource) GetSchemas

func (r *ReaderDataSource) GetSchemas(ctx context.Context) ([]string, error)

func (*ReaderDataSource) GetSequences

func (r *ReaderDataSource) GetSequences(ctx context.Context) ([]db.Sequence, error)

func (*ReaderDataSource) GetTables

func (r *ReaderDataSource) GetTables(ctx context.Context) ([]db.Table, error)

func (*ReaderDataSource) GetTriggers

func (r *ReaderDataSource) GetTriggers(ctx context.Context, table string) ([]db.Trigger, error)

func (*ReaderDataSource) IsLocalHost

func (r *ReaderDataSource) IsLocalHost(ctx context.Context) bool

func (*ReaderDataSource) StatusCheck

func (r *ReaderDataSource) StatusCheck(ctx context.Context) error

func (*ReaderDataSource) TableExists

func (r *ReaderDataSource) TableExists(table db.Table) bool

Jump to

Keyboard shortcuts

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