Documentation
¶
Overview ¶
Package postgres provides the PostgreSQL driver for the SQL executor.
Index ¶
- type PostgresDriver
- func (d *PostgresDriver) AcquireAdvisoryLock(ctx context.Context, db *sql.DB, lockName string) (func() error, error)
- func (d *PostgresDriver) BuildInsertQuery(table string, columns []string, rowCount int, ...) string
- func (d *PostgresDriver) Connect(ctx context.Context, cfg *sqlexec.Config) (*sql.DB, func() error, error)
- func (d *PostgresDriver) ConvertNamedParams(query string, params map[string]any) (string, []any, error)
- func (d *PostgresDriver) Name() string
- func (d *PostgresDriver) PlaceholderFormat() string
- func (d *PostgresDriver) QuoteIdentifier(name string) string
- func (d *PostgresDriver) SupportsAdvisoryLock() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresDriver ¶
type PostgresDriver struct{}
PostgresDriver implements the Driver interface for PostgreSQL.
func (*PostgresDriver) AcquireAdvisoryLock ¶
func (d *PostgresDriver) AcquireAdvisoryLock(ctx context.Context, db *sql.DB, lockName string) (func() error, error)
AcquireAdvisoryLock acquires a named advisory lock in PostgreSQL.
func (*PostgresDriver) BuildInsertQuery ¶
func (d *PostgresDriver) BuildInsertQuery(table string, columns []string, rowCount int, onConflict, conflictTarget string, updateColumns []string) string
BuildInsertQuery generates a multi-row INSERT statement for PostgreSQL. If onConflict is "replace" and conflictTarget is provided, generates a proper UPSERT.
func (*PostgresDriver) Connect ¶
func (d *PostgresDriver) Connect(ctx context.Context, cfg *sqlexec.Config) (*sql.DB, func() error, error)
Connect establishes a connection to PostgreSQL.
func (*PostgresDriver) ConvertNamedParams ¶
func (d *PostgresDriver) ConvertNamedParams(query string, params map[string]any) (string, []any, error)
ConvertNamedParams converts named parameters to PostgreSQL positional format.
func (*PostgresDriver) PlaceholderFormat ¶
func (d *PostgresDriver) PlaceholderFormat() string
PlaceholderFormat returns the PostgreSQL placeholder format.
func (*PostgresDriver) QuoteIdentifier ¶
func (d *PostgresDriver) QuoteIdentifier(name string) string
QuoteIdentifier quotes a table or column name for PostgreSQL. This handles reserved words and special characters by wrapping in double quotes.
func (*PostgresDriver) SupportsAdvisoryLock ¶
func (d *PostgresDriver) SupportsAdvisoryLock() bool
SupportsAdvisoryLock returns true as PostgreSQL supports advisory locks.