Documentation ¶
Overview ¶
Package pgutil contains utilities for postgres
Index ¶
- func CheckApplicationName(s string) (r string)
- func ConnstrWithSchema(connstr, schema string) string
- func CreateRandomTestingSchemaName(n int) string
- func CreateSchema(db Execer, schema string) (err error)
- func DropSchema(db Execer, schema string) error
- func IsConstraintError(err error) bool
- func LoadSchemaFromSQL(connstr, script string) (_ *dbschema.Schema, err error)
- func LoadSnapshotFromSQL(connstr, script string) (_ *dbschema.Snapshot, err error)
- func ParseSchemaFromConnstr(connstr string) (string, error)
- func QueryData(db dbschema.Queryer, schema *dbschema.Schema) (*dbschema.Data, error)
- func QuerySchema(db dbschema.Queryer) (*dbschema.Schema, error)
- func QuerySnapshot(db dbschema.Queryer) (*dbschema.Snapshot, error)
- func QuoteSchema(schema string) string
- type DB
- type Execer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckApplicationName ¶
CheckApplicationName ensures that the Connection String contains an application name
func ConnstrWithSchema ¶
ConnstrWithSchema adds schema to a connection string
func CreateRandomTestingSchemaName ¶
CreateRandomTestingSchemaName creates a random schema name string.
func CreateSchema ¶
CreateSchema creates a schema if it doesn't exist.
func IsConstraintError ¶
IsConstraintError checks if given error is about constraint violation
func LoadSchemaFromSQL ¶
LoadSchemaFromSQL inserts script into connstr and loads schema.
func LoadSnapshotFromSQL ¶
LoadSnapshotFromSQL inserts script into connstr and loads schema.
func ParseSchemaFromConnstr ¶
ParseSchemaFromConnstr returns the name of the schema parsed from the connection string if one is provided
func QuerySchema ¶
QuerySchema loads the schema from postgres database.
func QuerySnapshot ¶
QuerySnapshot loads snapshot from database