Documentation ¶
Overview ¶
Package driver implements an sqlboiler driver. It can be used by either building the main.go in the same project and using as a binary or using the side effect import.
Index ¶
- func Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)
- func PSQLBuildQueryString(user, pass, dbname, host string, port int, sslmode string) string
- type PostgresDriver
- func (p *PostgresDriver) Assemble(config drivers.Config) (dbinfo *drivers.DBInfo, err error)
- func (p *PostgresDriver) Columns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)
- func (p *PostgresDriver) ForeignKeyInfo(schema, tableName string) ([]drivers.ForeignKey, error)
- func (p PostgresDriver) Imports() (importers.Collection, error)
- func (p *PostgresDriver) PrimaryKeyInfo(schema, tableName string) (*drivers.PrimaryKey, error)
- func (p *PostgresDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error)
- func (p *PostgresDriver) Templates() (map[string]string, error)
- func (p *PostgresDriver) TranslateColumnType(c drivers.Column) drivers.Column
- func (p *PostgresDriver) ViewCapabilities(schema, name string) (drivers.ViewCapabilities, error)
- func (p *PostgresDriver) ViewColumns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)
- func (p *PostgresDriver) ViewNames(schema string, whitelist, blacklist []string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PostgresDriver ¶
type PostgresDriver struct {
// contains filtered or unexported fields
}
PostgresDriver holds the database connection string and a handle to the database connection.
func (*PostgresDriver) Assemble ¶
Assemble all the information we need to provide back to the driver
func (*PostgresDriver) Columns ¶
func (p *PostgresDriver) Columns(schema, tableName string, whitelist, blacklist []string) ([]drivers.Column, error)
Columns takes a table name and attempts to retrieve the table information from the database information_schema.columns. It retrieves the column names and column types and returns those as a []Column after TranslateColumnType() converts the SQL types to Go types, for example: "varchar" to "string"
func (*PostgresDriver) ForeignKeyInfo ¶
func (p *PostgresDriver) ForeignKeyInfo(schema, tableName string) ([]drivers.ForeignKey, error)
ForeignKeyInfo retrieves the foreign keys for a given table name.
func (PostgresDriver) Imports ¶
func (p PostgresDriver) Imports() (importers.Collection, error)
Imports for the postgres driver
func (*PostgresDriver) PrimaryKeyInfo ¶
func (p *PostgresDriver) PrimaryKeyInfo(schema, tableName string) (*drivers.PrimaryKey, error)
PrimaryKeyInfo looks up the primary key for a table.
func (*PostgresDriver) TableNames ¶
func (p *PostgresDriver) TableNames(schema string, whitelist, blacklist []string) ([]string, error)
TableNames connects to the postgres database and retrieves all table names from the information_schema where the table schema is schema. It uses a whitelist and blacklist.
func (*PostgresDriver) Templates ¶
func (p *PostgresDriver) Templates() (map[string]string, error)
Templates that should be added/overridden
func (*PostgresDriver) TranslateColumnType ¶
func (p *PostgresDriver) TranslateColumnType(c drivers.Column) drivers.Column
TranslateColumnType converts postgres database types to Go types, for example "varchar" to "string" and "bigint" to "int64". It returns this parsed data as a Column object.
func (*PostgresDriver) ViewCapabilities ¶ added in v4.8.4
func (p *PostgresDriver) ViewCapabilities(schema, name string) (drivers.ViewCapabilities, error)
ViewCapabilities return what actions are allowed for a view.
func (*PostgresDriver) ViewColumns ¶ added in v4.8.4
func (*PostgresDriver) ViewNames ¶ added in v4.8.4
func (p *PostgresDriver) ViewNames(schema string, whitelist, blacklist []string) ([]string, error)
ViewNames connects to the postgres database and retrieves all view names from the information_schema where the view schema is schema. It uses a whitelist and blacklist.