Documentation
¶
Index ¶
- func NewPostgreSQLAdapter(dsn string) (thing.DBAdapter, error)
- type Adapter
- func (a *Adapter) BeginTx(ctx context.Context, opts *sql.TxOptions) (thing.Tx, error)
- func (a *Adapter) Builder() thing.SQLBuilder
- func (a *Adapter) Close() error
- func (a *Adapter) DB() *sql.DB
- func (a *Adapter) DialectName() string
- func (a *Adapter) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (a *Adapter) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (a *Adapter) GetCount(ctx context.Context, tableName string, where string, args []interface{}) (int64, error)
- func (a *Adapter) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- type Dialector
- type PostgreSQLIntrospector
- type Tx
- func (tx *Tx) Commit() error
- func (tx *Tx) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (tx *Tx) Rollback() error
- func (tx *Tx) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
PostgreSQLAdapter implements the DBAdapter interface for PostgreSQL.
func (*Adapter) Builder ¶
func (a *Adapter) Builder() thing.SQLBuilder
Builder returns the SQLBuilder associated with the PostgreSQLAdapter.
func (*Adapter) DialectName ¶
DialectName returns the name of the database dialect.
func (*Adapter) Exec ¶
Exec executes a query that doesn't return rows. PostgreSQL uses '$N' placeholders.
func (*Adapter) Get ¶
func (a *Adapter) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error
Get retrieves a single row and scans it into the destination struct. Uses QueryContext and prepares scan destinations based on returned columns. PostgreSQL uses '$N' placeholders.
type Dialector ¶
type Dialector struct{}
PostgresDialector implements the sqlbuilder.Dialector interface for PostgreSQL.
func (Dialector) Placeholder ¶
type PostgreSQLIntrospector ¶
PostgreSQLIntrospector implements schema.Introspector for PostgreSQL.
func (*PostgreSQLIntrospector) GetTableInfo ¶
func (pi *PostgreSQLIntrospector) GetTableInfo(ctx context.Context, tableName string) (*driversSchema.TableInfo, error)
GetTableInfo introspects the given table and returns its schema info (PostgreSQL).