Documentation
¶
Index ¶
- func Offset(pageParam int64, pageSize uint64) uint64
- func PageSize(sizeParam int64) uint64
- type Client
- func (c *Client) Begin(ctx context.Context) (pgx.Tx, error)
- func (c *Client) Builder() sq.StatementBuilderType
- func (c *Client) Close()
- func (c *Client) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
- func (c *Client) QueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row
- type Config
- type DBClientInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a pgxpool.Pool for PostgreSQL access.
func (*Client) Builder ¶
func (c *Client) Builder() sq.StatementBuilderType
Builder returns a pre-configured squirrel StatementBuilderType for Postgres ($ placeholders)
func (*Client) Exec ¶
func (c *Client) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
Exec executes a query without returning any rows
type Config ¶
type Config struct {
Host string
Port int
User string
Password string
DBName string
SSLMode string
MaxOpenConns int32
MaxIdleConns int32
ConnMaxLifetime time.Duration
ConnMaxIdleTime time.Duration
ConnectTimeout time.Duration
}
Config holds PostgreSQL client configuration
type DBClientInterface ¶
type DBClientInterface interface {
// Query executes a query that returns rows
Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
// QueryRow executes a query that returns at most one row
QueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row
// Exec executes a query without returning any rows
Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
// Begin starts a new transaction
Begin(ctx context.Context) (pgx.Tx, error)
// Builder returns a pre-configured squirrel StatementBuilderType for Postgres ($N placeholders)
Builder() sq.StatementBuilderType
// Ping verifies the connection to the database is still alive
Ping(ctx context.Context) error
// Close closes the connection pool
Close()
}
DBClientInterface defines the interface for database operations using pgx native types.
Click to show internal directories.
Click to hide internal directories.