Documentation
¶
Index ¶
- type ColumnInfo
- type ColumnInfoEx
- type DBConfig
- type Postgres
- func (pg *Postgres) BeginTransaction() (*Transaction, error)
- func (pg *Postgres) Close()
- func (pg *Postgres) CreateGoStructDefinition(tableName string) (string, error)
- func (pg *Postgres) CreateInsertStatement(tableName string) (string, error)
- func (pg *Postgres) CreateUpdateStatement(tableName string, headers []string, row []string) (string, error)
- func (pg *Postgres) Exec(query string, args ...any) error
- func (pg *Postgres) Get(ret any, sqlStatement string, args ...any) error
- func (pg *Postgres) GetPrimaryKeyColumns(tableName string) ([]string, error)
- func (pg *Postgres) ListColumns(tableName string) ([]ColumnInfo, error)
- func (pg *Postgres) ListRecords(tableName string, pkField string, offset int, limit int, where string, ...) ([]map[string]any, []ColumnInfo, int, error)
- func (pg *Postgres) ListTablesAndViews() ([]TableInfo, error)
- func (pg *Postgres) Query(query string, args ...any) (*sql.Rows, error)
- func (pg *Postgres) QueryRow(query string, args ...any) *sql.Row
- func (pg *Postgres) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- func (pg *Postgres) QuerySQL(query string) ([]map[string]any, []ColumnInfo, error)
- func (pg *Postgres) RenameColumn(tableName string, oldColName string, newColName string) error
- func (pg *Postgres) RenameTable(oldName, newName string) error
- func (pg *Postgres) Stats() sql.DBStats
- func (pg *Postgres) UpdateDataCell(tableName, fieldName string, newValue any, pkField []string, pkValue []any) error
- type TableInfo
- type Transaction
- func (pg *Transaction) Commit() error
- func (pg *Transaction) Exec(query string, args ...any) error
- func (pg *Transaction) Get(dest any, query string, args ...any) error
- func (pg *Transaction) Query(query string, args ...any) (*sql.Rows, error)
- func (pg *Transaction) QueryRow(query string, args ...any) *sql.Row
- func (pg *Transaction) Rollback() error
- func (pg *Transaction) Select(dest any, query string, args ...any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnInfo ¶
type ColumnInfoEx ¶
type ColumnInfoEx struct {
ColumnName string `db:"column_name"`
DataType string `db:"data_type"`
ColumnDefault sql.NullString `db:"column_default"`
}
type Postgres ¶
func (*Postgres) BeginTransaction ¶
func (pg *Postgres) BeginTransaction() (*Transaction, error)
func (*Postgres) CreateGoStructDefinition ¶
func (*Postgres) CreateInsertStatement ¶
func (*Postgres) CreateUpdateStatement ¶ added in v0.0.8
func (*Postgres) GetPrimaryKeyColumns ¶
func (*Postgres) ListColumns ¶
func (pg *Postgres) ListColumns(tableName string) ([]ColumnInfo, error)
func (*Postgres) ListRecords ¶
func (*Postgres) ListTablesAndViews ¶
func (*Postgres) QueryRowContext ¶
func (*Postgres) QuerySQL ¶ added in v0.0.8
QuerySQL executes the given SQL query and returns records with column definitions.
func (*Postgres) RenameColumn ¶ added in v0.1.0
func (*Postgres) RenameTable ¶ added in v0.1.0
type TableInfo ¶
type TableInfo struct {
Name string `db:"table_name"`
Type string `db:"table_type"`
Size string `db:"table_size"`
PrimaryKey sql.NullString `db:"primary_key"`
}
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) Commit ¶
func (pg *Transaction) Commit() error
func (*Transaction) Rollback ¶
func (pg *Transaction) Rollback() error
Click to show internal directories.
Click to hide internal directories.