pg

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExist     = fmt.Errorf("schema or table does not exist")
	ErrAlreadyExist = fmt.Errorf("schema or table already exist")
)

Functions

This section is empty.

Types

type Placeholder

type Placeholder int

func (*Placeholder) Next

func (p *Placeholder) Next() string

type Pool

type Pool struct {
	*pgxpool.Pool
}

Pool data struct for *pgxpool.Pool.

func NewPool

func NewPool(connString string, logger *zap.Logger, lazy bool) (*Pool, error)

NewPool returns a pgxpool, a concurrency-safe connection pool for pgx.

func (*Pool) CreateSchema added in v0.0.5

func (pgPool *Pool) CreateSchema(ctx context.Context, db string) error

CreateSchema creates a new FerretDB database / PostgreSQL schema.

It returns ErrAlreadyExist if schema already exist.

func (*Pool) CreateTable added in v0.0.5

func (pgPool *Pool) CreateTable(ctx context.Context, db, collection string) error

CreateTable creates a new FerretDB collection / PostgreSQL jsonb table.

It returns ErrAlreadyExist if table already exist.

func (*Pool) DropSchema added in v0.0.5

func (pgPool *Pool) DropSchema(ctx context.Context, db string) error

DropSchema drops FerretDB database / PostgreSQL schema.

It returns ErrNotExist if schema does not exist.

func (*Pool) DropTable added in v0.0.5

func (pgPool *Pool) DropTable(ctx context.Context, db, collection string) error

DropTable drops FerretDB collection / PostgreSQL table.

It returns ErrNotExist is table does not exist.

func (*Pool) Schemas added in v0.0.5

func (pgPool *Pool) Schemas(ctx context.Context) ([]string, error)

Schemas returns a sorted list of FerretDB database / PostgreSQL schema names.

func (*Pool) TableStats added in v0.0.5

func (pgPool *Pool) TableStats(ctx context.Context, db, table string) (*TableStats, error)

TableStats returns a set of statistics for a table.

func (*Pool) Tables added in v0.0.5

func (pgPool *Pool) Tables(ctx context.Context, db string) ([]string, error)

Tables returns a sorted list of FerretDB collection / PostgreSQL table names.

type TableStats added in v0.0.5

type TableStats struct {
	Table       string
	TableType   string
	SizeTotal   int64
	SizeIndexes int64
	SizeTable   int64
	Rows        int64
}

TableStats describes some statistics for a table.

Jump to

Keyboard shortcuts

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