Documentation ¶
Overview ¶
Package models contains generated code for schema 'public'.
Index ¶
- func Errorf(s string, v ...interface{})
- func Logf(s string, v ...interface{})
- func MysqlSchema(ctx context.Context, db DB) (string, error)
- func MysqlViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
- func MysqlViewDrop(ctx context.Context, db DB, schema, id string) (sql.Result, error)
- func OracleSchema(ctx context.Context, db DB) (string, error)
- func OracleViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
- func OracleViewDrop(ctx context.Context, db DB, schema, id string) (sql.Result, error)
- func OracleViewTruncate(ctx context.Context, db DB, schema, id string) (sql.Result, error)
- func PostgresSchema(ctx context.Context, db DB) (string, error)
- func PostgresViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
- func PostgresViewDrop(ctx context.Context, db DB, schema, id string) (sql.Result, error)
- func PostgresViewSchema(ctx context.Context, db DB, id string) (string, error)
- func SetErrorLogger(logger interface{})
- func SetLogger(logger interface{})
- func Sqlite3Schema(ctx context.Context, db DB) (string, error)
- func Sqlite3ViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
- func Sqlite3ViewDrop(ctx context.Context, db DB, schema, id string) (sql.Result, error)
- func SqlserverSchema(ctx context.Context, db DB) (string, error)
- func SqlserverViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
- func SqlserverViewDrop(ctx context.Context, db DB, schema, id string) (sql.Result, error)
- type Column
- func MysqlTableColumns(ctx context.Context, db DB, schema, table string) ([]*Column, error)
- func OracleTableColumns(ctx context.Context, db DB, schema, table string) ([]*Column, error)
- func PostgresTableColumns(ctx context.Context, db DB, schema, table string, sys bool) ([]*Column, error)
- func Sqlite3TableColumns(ctx context.Context, db DB, schema, table string) ([]*Column, error)
- func SqlserverTableColumns(ctx context.Context, db DB, schema, table string) ([]*Column, error)
- type DB
- type Enum
- type EnumValue
- type ErrDecodeFailed
- type ErrInsertFailed
- type ErrUpdateFailed
- type ErrUpsertFailed
- type Error
- type ForeignKey
- func MysqlTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
- func OracleTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
- func PostgresTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
- func Sqlite3TableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
- func SqlserverTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
- type Index
- func MysqlTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)
- func OracleTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)
- func PostgresTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)
- func Sqlite3TableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)
- func SqlserverTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)
- type IndexColumn
- func MysqlIndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
- func OracleIndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
- func PostgresIndexColumns(ctx context.Context, db DB, schema, index string) ([]*IndexColumn, error)
- func Sqlite3IndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
- func SqlserverIndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
- type MysqlEnumValue
- type PostgresColOrder
- type Proc
- func MysqlProcs(ctx context.Context, db DB, schema string) ([]*Proc, error)
- func OracleProcs(ctx context.Context, db DB, schema string) ([]*Proc, error)
- func PostgresProcs(ctx context.Context, db DB, schema string) ([]*Proc, error)
- func SqlserverProcs(ctx context.Context, db DB, schema string) ([]*Proc, error)
- type ProcParam
- func MysqlProcParams(ctx context.Context, db DB, schema, id string) ([]*ProcParam, error)
- func OracleProcParams(ctx context.Context, db DB, schema, id string) ([]*ProcParam, error)
- func PostgresProcParams(ctx context.Context, db DB, schema, id string) ([]*ProcParam, error)
- func SqlserverProcParams(ctx context.Context, db DB, schema, id string) ([]*ProcParam, error)
- type Sequence
- func MysqlTableSequences(ctx context.Context, db DB, schema, table string) ([]*Sequence, error)
- func OracleTableSequences(ctx context.Context, db DB, schema, table string) ([]*Sequence, error)
- func PostgresTableSequences(ctx context.Context, db DB, schema, table string) ([]*Sequence, error)
- func Sqlite3TableSequences(ctx context.Context, db DB, schema, table string) ([]*Sequence, error)
- func SqlserverTableSequences(ctx context.Context, db DB, schema, table string) ([]*Sequence, error)
- type StringSlice
- type Table
- func MysqlTables(ctx context.Context, db DB, schema, typ string) ([]*Table, error)
- func OracleTables(ctx context.Context, db DB, schema, typ string) ([]*Table, error)
- func PostgresTables(ctx context.Context, db DB, schema, typ string) ([]*Table, error)
- func Sqlite3Tables(ctx context.Context, db DB, schema, typ string) ([]*Table, error)
- func SqlserverTables(ctx context.Context, db DB, schema, typ string) ([]*Table, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Errorf ¶
func Errorf(s string, v ...interface{})
Errorf logs an error message using the package error logger.
func MysqlSchema ¶
MysqlSchema retrieves the schema.
func MysqlViewCreate ¶
func MysqlViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
MysqlViewCreate creates a view for introspection.
func MysqlViewDrop ¶
MysqlViewDrop drops a view created for introspection.
func OracleSchema ¶
OracleSchema retrieves the schema.
func OracleViewCreate ¶
func OracleViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
OracleViewCreate creates a view for introspection.
func OracleViewDrop ¶
OracleViewDrop drops a view created for introspection.
func OracleViewTruncate ¶
OracleViewTruncate truncates a view created for introspection.
func PostgresSchema ¶
PostgresSchema retrieves the schema.
func PostgresViewCreate ¶
func PostgresViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
PostgresViewCreate creates a view for introspection.
func PostgresViewDrop ¶
PostgresViewDrop drops a view created for introspection.
func PostgresViewSchema ¶
PostgresViewSchema retrieves the schema for a view created for introspection.
func SetErrorLogger ¶
func SetErrorLogger(logger interface{})
SetErrorLogger sets the package error logger. Valid logger types:
io.Writer func(string, ...interface{}) (int, error) // fmt.Printf func(string, ...interface{}) // log.Printf
func SetLogger ¶
func SetLogger(logger interface{})
SetLogger sets the package logger. Valid logger types:
io.Writer func(string, ...interface{}) (int, error) // fmt.Printf func(string, ...interface{}) // log.Printf
func Sqlite3Schema ¶
Sqlite3Schema retrieves the schema.
func Sqlite3ViewCreate ¶
func Sqlite3ViewCreate(ctx context.Context, db DB, schema, id string, query []string) (sql.Result, error)
Sqlite3ViewCreate creates a view for introspection.
func Sqlite3ViewDrop ¶
Sqlite3ViewDrop drops a view created for introspection.
func SqlserverSchema ¶
SqlserverSchema retrieves the schema.
Types ¶
type Column ¶
type Column struct { FieldOrdinal int `json:"field_ordinal"` // field_ordinal ColumnName string `json:"column_name"` // column_name DataType string `json:"data_type"` // data_type NotNull bool `json:"not_null"` // not_null DefaultValue sql.NullString `json:"default_value"` // default_value IsPrimaryKey bool `json:"is_primary_key"` // is_primary_key Comment string `json:"comment"` // comment }
Column is a column.
func MysqlTableColumns ¶
MysqlTableColumns runs a custom query, returning results as Column.
func OracleTableColumns ¶
OracleTableColumns runs a custom query, returning results as Column.
func PostgresTableColumns ¶
func PostgresTableColumns(ctx context.Context, db DB, schema, table string, sys bool) ([]*Column, error)
PostgresTableColumns runs a custom query, returning results as Column.
func Sqlite3TableColumns ¶
Sqlite3TableColumns runs a custom query, returning results as Column.
type DB ¶
type DB interface { ExecContext(context.Context, string, ...interface{}) (sql.Result, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row }
DB is the common interface for database operations that can be used with types from schema 'public'.
This works with both database/sql.DB and database/sql.Tx.
type Enum ¶
type Enum struct {
EnumName string `json:"enum_name"` // enum_name
}
Enum is a enum.
func MysqlEnums ¶
MysqlEnums runs a custom query, returning results as Enum.
type EnumValue ¶
type EnumValue struct { EnumValue string `json:"enum_value"` // enum_value ConstValue int `json:"const_value"` // const_value }
EnumValue is a enum value.
type ErrDecodeFailed ¶
type ErrDecodeFailed struct {
Err error
}
ErrDecodeFailed is the decode failed error.
func (*ErrDecodeFailed) Error ¶
func (err *ErrDecodeFailed) Error() string
Error satisfies the error interface.
func (*ErrDecodeFailed) Unwrap ¶
func (err *ErrDecodeFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type ErrInsertFailed ¶
type ErrInsertFailed struct {
Err error
}
ErrInsertFailed is the insert failed error.
func (*ErrInsertFailed) Error ¶
func (err *ErrInsertFailed) Error() string
Error satisfies the error interface.
func (*ErrInsertFailed) Unwrap ¶
func (err *ErrInsertFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type ErrUpdateFailed ¶
type ErrUpdateFailed struct {
Err error
}
ErrUpdateFailed is the update failed error.
func (*ErrUpdateFailed) Error ¶
func (err *ErrUpdateFailed) Error() string
Error satisfies the error interface.
func (*ErrUpdateFailed) Unwrap ¶
func (err *ErrUpdateFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type ErrUpsertFailed ¶
type ErrUpsertFailed struct {
Err error
}
ErrUpsertFailed is the upsert failed error.
func (*ErrUpsertFailed) Error ¶
func (err *ErrUpsertFailed) Error() string
Error satisfies the error interface.
func (*ErrUpsertFailed) Unwrap ¶
func (err *ErrUpsertFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type Error ¶
type Error string
Error is an error.
const ( // ErrAlreadyExists is the already exists error. ErrAlreadyExists Error = "already exists" // ErrDoesNotExist is the does not exist error. ErrDoesNotExist Error = "does not exist" // ErrMarkedForDeletion is the marked for deletion error. ErrMarkedForDeletion Error = "marked for deletion" )
Error values.
const ErrInvalidStringSlice Error = "invalid StringSlice"
ErrInvalidStringSlice is the invalid StringSlice error.
type ForeignKey ¶
type ForeignKey struct { ForeignKeyName string `json:"foreign_key_name"` // foreign_key_name ColumnName string `json:"column_name"` // column_name RefTableName string `json:"ref_table_name"` // ref_table_name RefColumnName string `json:"ref_column_name"` // ref_column_name KeyID int `json:"key_id"` // key_id }
ForeignKey is a foreign key.
func MysqlTableForeignKeys ¶
MysqlTableForeignKeys runs a custom query, returning results as ForeignKey.
func OracleTableForeignKeys ¶
func OracleTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
OracleTableForeignKeys runs a custom query, returning results as ForeignKey.
func PostgresTableForeignKeys ¶
func PostgresTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
PostgresTableForeignKeys runs a custom query, returning results as ForeignKey.
func Sqlite3TableForeignKeys ¶
func Sqlite3TableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
Sqlite3TableForeignKeys runs a custom query, returning results as ForeignKey.
func SqlserverTableForeignKeys ¶
func SqlserverTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)
SqlserverTableForeignKeys runs a custom query, returning results as ForeignKey.
type Index ¶
type Index struct { IndexName string `json:"index_name"` // index_name IsUnique bool `json:"is_unique"` // is_unique IsPrimary bool `json:"is_primary"` // is_primary }
Index is a index.
func MysqlTableIndexes ¶
MysqlTableIndexes runs a custom query, returning results as Index.
func OracleTableIndexes ¶
OracleTableIndexes runs a custom query, returning results as Index.
func PostgresTableIndexes ¶
PostgresTableIndexes runs a custom query, returning results as Index.
func Sqlite3TableIndexes ¶
Sqlite3TableIndexes runs a custom query, returning results as Index.
type IndexColumn ¶
type IndexColumn struct { SeqNo int `json:"seq_no"` // seq_no Cid int `json:"cid"` // cid ColumnName string `json:"column_name"` // column_name }
IndexColumn is a index column.
func MysqlIndexColumns ¶
func MysqlIndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
MysqlIndexColumns runs a custom query, returning results as IndexColumn.
func OracleIndexColumns ¶
func OracleIndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
OracleIndexColumns runs a custom query, returning results as IndexColumn.
func PostgresIndexColumns ¶
PostgresIndexColumns runs a custom query, returning results as IndexColumn.
func Sqlite3IndexColumns ¶
func Sqlite3IndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
Sqlite3IndexColumns runs a custom query, returning results as IndexColumn.
func SqlserverIndexColumns ¶
func SqlserverIndexColumns(ctx context.Context, db DB, schema, table, index string) ([]*IndexColumn, error)
SqlserverIndexColumns runs a custom query, returning results as IndexColumn.
type MysqlEnumValue ¶
type MysqlEnumValue struct {
EnumValues string `json:"enum_values"` // enum_values
}
MysqlEnumValue represents a row from 'mysql.mysql_enum_value'.
func MysqlEnumValues ¶
MysqlEnumValues runs a custom query, returning results as MysqlEnumValue.
type PostgresColOrder ¶
type PostgresColOrder struct {
Ord string `json:"ord"` // ord
}
PostgresColOrder is a index column order.
func PostgresGetColOrder ¶
func PostgresGetColOrder(ctx context.Context, db DB, schema, index string) (*PostgresColOrder, error)
PostgresGetColOrder runs a custom query, returning results as PostgresColOrder.
type Proc ¶
type Proc struct { ProcID string `json:"proc_id"` // proc_id ProcName string `json:"proc_name"` // proc_name ProcType string `json:"proc_type"` // proc_type ReturnType string `json:"return_type"` // return_type ReturnName string `json:"return_name"` // return_name ProcDef string `json:"proc_def"` // proc_def }
Proc is a stored procedure.
func MysqlProcs ¶
MysqlProcs runs a custom query, returning results as Proc.
func OracleProcs ¶
OracleProcs runs a custom query, returning results as Proc.
func PostgresProcs ¶
PostgresProcs runs a custom query, returning results as Proc.
type ProcParam ¶
type ProcParam struct { ParamName string `json:"param_name"` // param_name ParamType string `json:"param_type"` // param_type }
ProcParam is a stored procedure param.
func MysqlProcParams ¶
MysqlProcParams runs a custom query, returning results as ProcParam.
func OracleProcParams ¶
OracleProcParams runs a custom query, returning results as ProcParam.
func PostgresProcParams ¶
PostgresProcParams runs a custom query, returning results as ProcParam.
type Sequence ¶
type Sequence struct {
ColumnName string `json:"column_name"` // column_name
}
Sequence is a sequence.
func MysqlTableSequences ¶
MysqlTableSequences runs a custom query, returning results as Sequence.
func OracleTableSequences ¶
OracleTableSequences runs a custom query, returning results as Sequence.
func PostgresTableSequences ¶
PostgresTableSequences runs a custom query, returning results as Sequence.
func Sqlite3TableSequences ¶
Sqlite3TableSequences runs a custom query, returning results as Sequence.
type StringSlice ¶
type StringSlice []string
StringSlice is a slice of strings.
func (*StringSlice) Scan ¶
func (ss *StringSlice) Scan(v interface{}) error
Scan satisfies the sql.Scanner interface for StringSlice.
type Table ¶
type Table struct { Type string `json:"type"` // type TableName string `json:"table_name"` // table_name ManualPk bool `json:"manual_pk"` // manual_pk ViewDef string `json:"view_def"` // view_def }
Table is a table.
func MysqlTables ¶
MysqlTables runs a custom query, returning results as Table.
func OracleTables ¶
OracleTables runs a custom query, returning results as Table.
func PostgresTables ¶
PostgresTables runs a custom query, returning results as Table.
func Sqlite3Tables ¶
Sqlite3Tables runs a custom query, returning results as Table.