pgsql

package
v0.9.3-patch.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 13 Imported by: 0

README

postgres

A PostgreSQL Driver for Goent ORM

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(c Config) config

Types

type Config

type Config struct {
	Logger           model.Logger
	IncludeArguments bool          // include all arguments used on query
	QueryThreshold   time.Duration // query threshold to warning on slow queries

	MigratePath string // output sql file, if defined the driver will not auto apply the migration.
}

Config contains PostgreSQL driver configuration options.

type Connection

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

func (Connection) ExecContext

func (c Connection) ExecContext(ctx context.Context, query *model.Query) error

func (Connection) QueryContext

func (c Connection) QueryContext(ctx context.Context, query *model.Query) (model.Rows, error)

func (Connection) QueryRowContext

func (c Connection) QueryRowContext(ctx context.Context, query *model.Query) model.Row

type Driver

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

Driver implements the PostgreSQL database driver using pgx.

func Open

func Open(dsn string, c config) (driver *Driver)

func OpenDSN

func OpenDSN(dsn string) (driver *Driver)

func (*Driver) AddLogger

func (dr *Driver) AddLogger(logger model.Logger, err error) error

func (*Driver) Close

func (dr *Driver) Close() error

func (*Driver) DropColumn

func (dr *Driver) DropColumn(schema, table, column string) error

func (*Driver) DropTable

func (dr *Driver) DropTable(schema, table string) error

func (*Driver) ErrorTranslator

func (dr *Driver) ErrorTranslator() func(err error) error

func (*Driver) FormatTableName

func (dr *Driver) FormatTableName(schema, table string) string

func (*Driver) GetDatabaseConfig

func (dr *Driver) GetDatabaseConfig() *model.DatabaseConfig

func (*Driver) Init

func (dr *Driver) Init() error

func (*Driver) KeywordHandler

func (dr *Driver) KeywordHandler(s string) string

func (*Driver) MigrateContext

func (dr *Driver) MigrateContext(ctx context.Context, migrator *model.Migrator) error

func (*Driver) Name

func (dr *Driver) Name() string

func (*Driver) NewConnection

func (dr *Driver) NewConnection() model.Connection

func (*Driver) NewTransaction

func (dr *Driver) NewTransaction(ctx context.Context, opts *sql.TxOptions) (model.Transaction, error)

func (*Driver) RenameColumn

func (dr *Driver) RenameColumn(schema, table, oldColumn, newColumn string) error

func (*Driver) RenameTable

func (dr *Driver) RenameTable(schema, table, newTable string) error

func (*Driver) Stats

func (dr *Driver) Stats() sql.DBStats

func (*Driver) SupportsReturning

func (dr *Driver) SupportsReturning() bool

type PgSchemaDriver added in v0.9.2

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

func NewPgSchemaDriver added in v0.9.2

func NewPgSchemaDriver(schema string, queryFn func(ctx context.Context, sql string, args ...any) (model.Rows, error), execFn func(ctx context.Context, sql string, args ...any) error) *PgSchemaDriver

func (*PgSchemaDriver) DiscoverFKs added in v0.9.2

func (p *PgSchemaDriver) DiscoverFKs(ctx context.Context, table string) ([]model.FKRef, error)

func (*PgSchemaDriver) DropTables added in v0.9.2

func (p *PgSchemaDriver) DropTables(ctx context.Context, tables []string) error

func (*PgSchemaDriver) GetColumns added in v0.9.2

func (p *PgSchemaDriver) GetColumns(ctx context.Context, table string) ([]model.ColumnDef, error)

func (*PgSchemaDriver) GetForeignKeys added in v0.9.2

func (p *PgSchemaDriver) GetForeignKeys(ctx context.Context, table string) ([]model.ForeignKeyDef, error)

func (*PgSchemaDriver) GetIndexStats added in v0.9.2

func (p *PgSchemaDriver) GetIndexStats(ctx context.Context) ([]model.IndexStat, error)

func (*PgSchemaDriver) GetIndexes added in v0.9.2

func (p *PgSchemaDriver) GetIndexes(ctx context.Context, table string) ([]model.IndexDef, error)

func (*PgSchemaDriver) GetPrimaryKey added in v0.9.2

func (p *PgSchemaDriver) GetPrimaryKey(ctx context.Context, table string) ([]string, error)

func (*PgSchemaDriver) GetTableRowCount added in v0.9.2

func (p *PgSchemaDriver) GetTableRowCount(ctx context.Context, table string) (int64, error)

func (*PgSchemaDriver) GetTableStats added in v0.9.2

func (p *PgSchemaDriver) GetTableStats(ctx context.Context) ([]model.TableStat, error)

func (*PgSchemaDriver) GetVersion added in v0.9.2

func (p *PgSchemaDriver) GetVersion(ctx context.Context) (string, error)

func (*PgSchemaDriver) IsColumnNullable added in v0.9.2

func (p *PgSchemaDriver) IsColumnNullable(_ context.Context, _, _ string) bool

func (*PgSchemaDriver) ListTables added in v0.9.2

func (p *PgSchemaDriver) ListTables(ctx context.Context) ([]string, error)

func (*PgSchemaDriver) ListTablesInSchema added in v0.9.2

func (p *PgSchemaDriver) ListTablesInSchema(ctx context.Context, schema string) ([]string, error)

func (*PgSchemaDriver) ResetSequence added in v0.9.2

func (p *PgSchemaDriver) ResetSequence(ctx context.Context, seqName string, nextVal int64) error

func (*PgSchemaDriver) SequenceExists added in v0.9.2

func (p *PgSchemaDriver) SequenceExists(ctx context.Context, seqName string) (bool, error)

func (*PgSchemaDriver) TruncateTable added in v0.9.2

func (p *PgSchemaDriver) TruncateTable(ctx context.Context, table string) error

type Row added in v0.8.1

type Row struct {
	pgx.Row
	// contains filtered or unexported fields
}

func (Row) Scan added in v0.8.1

func (r Row) Scan(dest ...any) error

type Rows

type Rows struct {
	pgx.Rows
}

func (*Rows) Close

func (rs *Rows) Close() error

type SavePoint

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

func (SavePoint) Commit

func (s SavePoint) Commit() error

func (SavePoint) Rollback

func (s SavePoint) Rollback() error

type Transaction

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

func (Transaction) Commit

func (t Transaction) Commit() error

func (Transaction) ExecContext

func (t Transaction) ExecContext(ctx context.Context, query *model.Query) error

func (Transaction) QueryContext

func (t Transaction) QueryContext(ctx context.Context, query *model.Query) (model.Rows, error)

func (Transaction) QueryRowContext

func (t Transaction) QueryRowContext(ctx context.Context, query *model.Query) model.Row

func (Transaction) Rollback

func (t Transaction) Rollback() error

func (Transaction) SavePoint

func (t Transaction) SavePoint() (model.SavePoint, error)

Jump to

Keyboard shortcuts

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