Documentation
¶
Index ¶
- type Config
- type Database
- func (db *Database) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
- func (db *Database) ExecQueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row
- func (db *Database) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (db *Database) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- type QueryEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
User string `yaml:"user"`
Password string `yaml:"password"`
Host string `yaml:"host"`
Port int `yaml:"port"`
DBName string `yaml:"db"`
}
Config содержит конфигурацию подключения к базе данных.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database обертка для работы с pgxpool.Pool.
func (*Database) Exec ¶
func (db *Database) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
Exec выполняет запрос.
func (*Database) ExecQueryRow ¶
ExecQueryRow выполняет запрос и возвращает строку.
type QueryEngine ¶
type QueryEngine interface {
Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
}
QueryEngine интерфейс для работы с запросами к бд.
Click to show internal directories.
Click to hide internal directories.