Documentation ¶
Index ¶
- func AddUniqueSpecifier(cols []*schema.Column, colname string) error
- type Binder
- type ConnSpec
- type DB
- func (p DB) ActiveConnections(db string) ([]PID, error)
- func (p DB) CreateDatabase(db string) error
- func (p DB) CreateExtension(ext string) error
- func (p DB) CreateUser(user, pass string) error
- func (p DB) DatabaseExists(db string) (bool, error)
- func (p DB) ExtensionExists(ext string) (bool, error)
- func (p DB) GrantDBOwner(db, user string) error
- func (p DB) IntrospectSchema() (*schema.Schema, error)
- func (p DB) IntrospectTable(table string) (*schema.Table, error)
- func (p DB) IntrospectTableColumns(table string) ([]*schema.Column, error)
- func (p DB) IntrospectTableConstraints(table string, cols []*schema.Column) ([]schema.Constraint, error)
- func (p DB) IntrospectTableForeignKeys(table string) ([]schema.Constraint, error)
- func (p DB) IntrospectTableIndexes(table string, cols []*schema.Column) ([]*schema.Index, error)
- func (p DB) IntrospectTableNames() ([]string, error)
- func (p DB) IntrospectTablePrimaryKey(table string) (schema.Constraint, error)
- func (p DB) IntrospectTableSchemas(tables []string) (schemas []*schema.Table, err error)
- func (p DB) IntrospectTableUniqueConstraints(table string, cols []*schema.Column) error
- func (p DB) RowExists(query string, binds ...interface{}) (bool, error)
- func (p DB) TerminateConnection(pid PID) error
- func (p DB) UserExists(user string) (bool, error)
- type Error
- type PID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Binder ¶
type Binder int
Binder tracks a postgres query bind variable.
func NewBinder ¶
func NewBinder() *Binder
NewBinder creates a bind variable generator initialized to 1.
type ConnSpec ¶
ConnSpec is a PostgreSQL connection spec.
func (ConnSpec) ConnectionString ¶
ConnectionString constructs a connection string suitable for use in sql.Open
func (ConnSpec) GetSSLMode ¶
GetSSLMode returns the SSL mode setting, defaulting to "disable".
type DB ¶
DB is a wrapper around database/sql.DB.
func OpenDBUser ¶
OpenDBUser opens the named PostgreSQL database with the given username and password.
func (DB) ActiveConnections ¶
ActiveConnections gets the list of client PIDs connected to the DB.
func (DB) CreateDatabase ¶
CreateDatabase creates a database named db
func (DB) CreateExtension ¶
CreateExtension creates a pg extension named ext
func (DB) CreateUser ¶
CreateUser creates a user with the given password pass.
func (DB) DatabaseExists ¶
DatabaseExists checks if the database named db exists.
func (DB) ExtensionExists ¶
ExtensionExists checks if the postgres extension ext exists.
func (DB) GrantDBOwner ¶
GrantDBOwner alters the database owner to user.
func (DB) IntrospectSchema ¶
IntrospectSchema discovers the database schema.
func (DB) IntrospectTable ¶
IntrospectTable discovers the structure of table.
func (DB) IntrospectTableColumns ¶
IntrospectTableColumns introspects the columns in table from the db.
func (DB) IntrospectTableConstraints ¶
func (p DB) IntrospectTableConstraints(table string, cols []*schema.Column) ([]schema.Constraint, error)
IntrospectTableConstraints discovers the constraints on table with cols.
func (DB) IntrospectTableForeignKeys ¶
func (p DB) IntrospectTableForeignKeys(table string) ([]schema.Constraint, error)
IntrospectTableForeignKeys discovers the foreign keys for table.
func (DB) IntrospectTableIndexes ¶
IntrospectTableIndexes discovers the indexes for table with cols.
func (DB) IntrospectTableNames ¶
IntrospectTableNames discovers the names of tables in the db.
func (DB) IntrospectTablePrimaryKey ¶
func (p DB) IntrospectTablePrimaryKey(table string) (schema.Constraint, error)
IntrospectTablePrimaryKey discovers the primary key for a table.
func (DB) IntrospectTableSchemas ¶
IntrospectTableSchemas discovers the structure of the named tables in the db.
func (DB) IntrospectTableUniqueConstraints ¶
IntrospectTableUniqueConstraints discovers the unique constraints for table with cols.
func (DB) TerminateConnection ¶
TerminateConnection kills the connection specified by pid.