postgres

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: GPL-3.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapperCache = tldb.MapperCache

Functions

This section is empty.

Types

type Adapter

type Adapter = tldb.Adapter

type Ext

type Ext = tldb.Ext

type PostgresAdapter

type PostgresAdapter struct {
	DBURL string
	// contains filtered or unexported fields
}

PostgresAdapter connects to a Postgres/PostGIS database.

func NewPostgresAdapterFromDBX

func NewPostgresAdapterFromDBX(db Ext) *PostgresAdapter

func (*PostgresAdapter) Close

func (adapter *PostgresAdapter) Close() error

Close the adapter.

func (*PostgresAdapter) Create

func (adapter *PostgresAdapter) Create() error

Create an initial database schema.

func (*PostgresAdapter) DBX

func (adapter *PostgresAdapter) DBX() Ext

DBX returns sqlx.Ext

func (*PostgresAdapter) Find

func (adapter *PostgresAdapter) Find(ctx context.Context, dest interface{}) error

Find finds a single entity based on the EntityID()

func (*PostgresAdapter) Get

func (adapter *PostgresAdapter) Get(ctx context.Context, dest interface{}, qstr string, args ...interface{}) error

Get wraps sqlx.Get

func (*PostgresAdapter) Insert

func (adapter *PostgresAdapter) Insert(ctx context.Context, ent interface{}) (int, error)

Insert builds and executes an insert statement for the given entity.

func (*PostgresAdapter) MultiInsert

func (adapter *PostgresAdapter) MultiInsert(ctx context.Context, ents []interface{}) ([]int, error)

MultiInsert builds and executes a multi-insert statement for the given entities.

func (*PostgresAdapter) Open

func (adapter *PostgresAdapter) Open() error

Open the adapter.

func (*PostgresAdapter) OpenDB added in v1.2.0

func (adapter *PostgresAdapter) OpenDB() (*sqlx.DB, error)

func (*PostgresAdapter) Select

func (adapter *PostgresAdapter) Select(ctx context.Context, dest interface{}, qstr string, args ...interface{}) error

Select wraps sqlx.Select

func (*PostgresAdapter) Sqrl

func (adapter *PostgresAdapter) Sqrl() sq.StatementBuilderType

Sqrl returns a properly configured Squirrel StatementBuilder.

func (*PostgresAdapter) SupportsSpatialFunctions added in v1.3.0

func (adapter *PostgresAdapter) SupportsSpatialFunctions() bool

SupportsSpatialFunctions returns true as PostgreSQL with PostGIS supports spatial functions like ST_Centroid and ST_Simplify.

func (*PostgresAdapter) TableExists

func (adapter *PostgresAdapter) TableExists(t string) (bool, error)

TableExists returns true if the requested table exists

func (*PostgresAdapter) Tx

func (adapter *PostgresAdapter) Tx(cb func(Adapter) error) error

Tx runs a callback inside a transaction.

func (*PostgresAdapter) Update

func (adapter *PostgresAdapter) Update(ctx context.Context, ent interface{}, columns ...string) error

Update a single entity.

type QueryLogger

type QueryLogger = querylogger.QueryLogger

Jump to

Keyboard shortcuts

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