Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTxCommitRollback = pgx.ErrTxCommitRollback ErrTooManyRows = pgx.ErrTooManyRows ErrTxClosed = pgx.ErrTxClosed ErrNoRows = pgx.ErrNoRows )
Functions ¶
This section is empty.
Types ¶
type BatchResults ¶
type BatchResults = pgx.BatchResults
type Client ¶
Client is interface for communicate with postgres database.
func New ¶
ConnectToDb returns a pointer to a pgxpool.Pool representing the database connection pool.
func NewWithMock ¶
type Config ¶
type Config struct {
Host string `yaml:"host" env:"PG_HOST" env-default:"localhost"`
Port int `yaml:"port" env:"PG_PORT" env-default:"5432"`
DBName string `yaml:"dbname" env:"PG_NAME" env-default:"postgres"`
Username string `yaml:"username" env:"PG_USER"`
Password string `env:"POSTGRES_PASSWORD"`
SSLMode string `yaml:"sslmode" env:"PG_SSLMODE" env-default:"disabled"`
MigrationsRun bool `yaml:"migrations_run" env:"PG_MIGRATIONS_RUN" env-default:"false"`
MigrationsPath string `yaml:"migrations_path" env:"PG_MIGRATIONS_PATH"`
}
Config is type for database connection.
type CopyFromSource ¶
type CopyFromSource = pgx.CopyFromSource
type Identifier ¶
type Identifier = pgx.Identifier
type Pool ¶
type Pool interface {
Acquire(ctx context.Context) (c *pgxpool.Conn, err error)
AcquireFunc(ctx context.Context, f func(*pgxpool.Conn) error) error
Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
AcquireAllIdle(ctx context.Context) []*pgxpool.Conn
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
Ping(ctx context.Context) error
Begin(ctx context.Context) (pgx.Tx, error)
Stat() *pgxpool.Stat
Config() *pgxpool.Config
Reset()
Close()
}
Click to show internal directories.
Click to hide internal directories.