pg

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// Table uses JSONB1 storage.
	JSONB1Table = "jsonb1"

	// Table uses SQL storage.
	SQLTable = "sql"
)

Variables

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

Functions

func IsValidUTF8Locale added in v0.0.6

func IsValidUTF8Locale(setting string) bool

IsValidUTF8Locale Currently supported locale variants, compromised between https://www.postgresql.org/docs/9.3/multibyte.html and https://www.gnu.org/software/libc/manual/html_node/Locale-Names.html.

Valid examples: * en_US.utf8, * en_US.utf-8 * en_US.UTF8, * en_US.UTF-8.

Types

type DBStats added in v0.0.6

type DBStats struct {
	Name         string
	CountTables  int32
	CountRows    int32
	SizeTotal    int64
	SizeIndexes  int64
	SizeSchema   int64
	CountIndexes int32
}

DBStats describes some statistics for a database.

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, schema 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, schema, table string) error

CreateTable creates a new FerretDB collection / PostgreSQL jsonb1 table.

It returns ErrAlreadyExist if table already exist.

func (*Pool) DropSchema added in v0.0.5

func (pgPool *Pool) DropSchema(ctx context.Context, schema 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, schema, table string) error

DropTable drops FerretDB collection / PostgreSQL table.

It returns ErrNotExist is table does not exist.

func (*Pool) SchemaStats added in v0.0.6

func (pgPool *Pool) SchemaStats(ctx context.Context, schema string) (*DBStats, error)

SchemaStats returns a set of statistics for FerretDB database / PostgreSQL schema.

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, schema, table string) (*TableStats, error)

TableStats returns a set of statistics for FerretDB collection / PostgreSQL table.

func (*Pool) Tables added in v0.0.5

func (pgPool *Pool) Tables(ctx context.Context, schema string) ([]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   int32
	SizeIndexes int32
	SizeTable   int32
	Rows        int32
}

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