postgres

package
v0.0.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Url                   string        `env:"POSTGRES_URL,required"`
	MaxConnection         int32         `env:"POSTGRES_MAX_CONNECTION,required"`
	MinConnection         int32         `env:"POSTGRES_MIN_CONNECTION,required"`
	MaxConnectionIdleTime time.Duration `env:"POSTGRES_MAX_IDLE_TIME,required"`
	LogLevel              LogLevel      `env:"POSTGRES_LOG_LEVEL" envDefault:"ERROR"`
}

func NewConfig

func NewConfig() (*Config, error)

type LogLevel

type LogLevel tracelog.LogLevel

func (*LogLevel) UnmarshalText

func (t *LogLevel) UnmarshalText(text []byte) error

type PostgreSQL

type PostgreSQL interface {
	pgxscan.Querier
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	Begin(ctx context.Context) (pgx.Tx, error)
	BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type Postgres

type Postgres struct {
	*pgxpool.Pool
}

func NewPostgres

func NewPostgres(config *Config) (*Postgres, error)

Jump to

Keyboard shortcuts

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