postgres

package
v0.10.0-wip Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package postgres provides the PostgreSQL database driver implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgreSQLDriver

func NewPostgreSQLDriver() database.DatabaseDriver

NewPostgreSQLDriver creates a new PostgreSQL driver.

Types

type PostgreSQLDriver

type PostgreSQLDriver struct {
	// contains filtered or unexported fields
}

PostgreSQLDriver implements the DatabaseDriver interface for PostgreSQL.

func (*PostgreSQLDriver) BeginTx

BeginTx starts a new transaction.

func (*PostgreSQLDriver) Close

func (d *PostgreSQLDriver) Close() error

Close closes the database connection.

func (*PostgreSQLDriver) Connect

func (d *PostgreSQLDriver) Connect(ctx context.Context, dsn string) error

Connect establishes a connection to PostgreSQL.

func (*PostgreSQLDriver) CreateTable

func (d *PostgreSQLDriver) CreateTable(schema database.TableSchema) (database.Query, error)

CreateTable generates and returns a CREATE TABLE query for PostgreSQL.

func (*PostgreSQLDriver) Delete

func (d *PostgreSQLDriver) Delete(table string, where string, whereArgs ...interface{}) (database.Query, error)

Delete generates a DELETE query.

func (*PostgreSQLDriver) DropTable

func (d *PostgreSQLDriver) DropTable(tableName string) (database.Query, error)

DropTable generates a DROP TABLE query.

func (*PostgreSQLDriver) Exec

func (d *PostgreSQLDriver) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

Exec executes a query without returning rows.

func (*PostgreSQLDriver) Insert

func (d *PostgreSQLDriver) Insert(table string, data map[string]interface{}) (database.Query, error)

Insert generates an INSERT query with RETURNING support.

func (*PostgreSQLDriver) MapType

func (d *PostgreSQLDriver) MapType(schemaType string) string

MapType maps schema types to PostgreSQL types.

func (*PostgreSQLDriver) Ping

func (d *PostgreSQLDriver) Ping(ctx context.Context) error

Ping checks if the connection is alive.

func (*PostgreSQLDriver) Query

func (d *PostgreSQLDriver) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

Query executes a query that returns rows.

func (*PostgreSQLDriver) QueryRow

func (d *PostgreSQLDriver) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row

QueryRow executes a query that returns at most one row.

func (*PostgreSQLDriver) Select

func (d *PostgreSQLDriver) Select(table string, columns []string, where string, whereArgs ...interface{}) (database.Query, error)

Select generates a SELECT query.

func (*PostgreSQLDriver) SupportsArrays

func (d *PostgreSQLDriver) SupportsArrays() bool

SupportsArrays returns true for PostgreSQL.

func (*PostgreSQLDriver) SupportsLastInsertId

func (d *PostgreSQLDriver) SupportsLastInsertId() bool

SupportsLastInsertId returns false for PostgreSQL.

func (*PostgreSQLDriver) SupportsReturning

func (d *PostgreSQLDriver) SupportsReturning() bool

SupportsReturning returns true for PostgreSQL.

func (*PostgreSQLDriver) TableExists

func (d *PostgreSQLDriver) TableExists(tableName string) (bool, error)

TableExists checks if a table exists.

func (*PostgreSQLDriver) Update

func (d *PostgreSQLDriver) Update(table string, data map[string]interface{}, where string, whereArgs ...interface{}) (database.Query, error)

Update generates an UPDATE query.

Jump to

Keyboard shortcuts

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