Help us shape the future of Go! Take the 2026 Go Developer Survey

postgres

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(driverName, dsn string) (*sql.DB, error)

func SampleMainPgx added in v0.4.0

func SampleMainPgx(yml []byte) error

func SampleMainStd added in v0.4.0

func SampleMainStd(yml []byte, driverName string) error

Types

type Book added in v0.4.0

type Book struct {
	ID          int32
	Title       string
	Author      *string
	Publisher   *string
	Price       *int32
	ReleaseDate *time.Time
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type Postgres

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

func NewPostgres

func NewPostgres(ctx context.Context, dsn string) (*Postgres, error)

func (*Postgres) Acquire added in v0.4.0

func (pg *Postgres) Acquire(ctx context.Context) (*pgxpool.Conn, error)

func (*Postgres) Begin

func (pg *Postgres) Begin(ctx context.Context) (pgx.Tx, error)

func (*Postgres) BeginReadOnly

func (pg *Postgres) BeginReadOnly(ctx context.Context) (pgx.Tx, error)

func (*Postgres) Close

func (pg *Postgres) Close()

func (*Postgres) CreateDatabase

func (pg *Postgres) CreateDatabase(ctx context.Context, dbname string) error

func (*Postgres) CreateDatabaseIfNotExists

func (pg *Postgres) CreateDatabaseIfNotExists(ctx context.Context, dbname string) error

func (*Postgres) CreateOrReplaceDatabase

func (pg *Postgres) CreateOrReplaceDatabase(ctx context.Context, dbname string) error

func (*Postgres) DropDatabase

func (pg *Postgres) DropDatabase(ctx context.Context, dbname string) error

func (*Postgres) DropDatabaseIfExists

func (pg *Postgres) DropDatabaseIfExists(ctx context.Context, dbname string) error

func (*Postgres) Ping

func (pg *Postgres) Ping(ctx context.Context) error

Jump to

Keyboard shortcuts

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