models

package
v0.0.0-...-fe6f8ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package models contains generated code for schema 'public'.

Index

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 Logf

func Logf(s string, v ...interface{})

Logf logs a message using the package logger.

func MysqlSchema

func MysqlSchema(ctx context.Context, db DB) (string, error)

MysqlSchema retrieves the current schema.

func OracleSchema

func OracleSchema(ctx context.Context, db DB) (string, error)

OracleSchema retrieves the current schema.

func PostgresSchema

func PostgresSchema(ctx context.Context, db DB) (string, error)

PostgresSchema retrieves the current schema.

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

func Sqlite3Schema(ctx context.Context, db DB) (string, error)

Sqlite3Schema retrieves the current schema.

func SqlserverSchema

func SqlserverSchema(ctx context.Context, db DB) (string, error)

SqlserverSchema retrieves the current 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
	ExcelColumn  string         `json:"excel_column"`   // excel_column
	Label        string         `json:"label"`          // label
}

Column represents column info.

func MysqlTableColumns

func MysqlTableColumns(ctx context.Context, db DB, schema, table string) ([]*Column, error)

MysqlTableColumns runs a custom query, returning results as Column.

func OracleTableColumns

func OracleTableColumns(ctx context.Context, db DB, schema, table string) ([]*Column, error)

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

func Sqlite3TableColumns(ctx context.Context, db DB, table string) ([]*Column, error)

Sqlite3TableColumns runs a custom query, returning results as Column.

func SqlserverTableColumns

func SqlserverTableColumns(ctx context.Context, db DB, schema, table string) ([]*Column, error)

SqlserverTableColumns 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 represents a enum.

func MysqlEnums

func MysqlEnums(ctx context.Context, db DB, schema string) ([]*Enum, error)

MysqlEnums runs a custom query, returning results as Enum.

func PostgresEnums

func PostgresEnums(ctx context.Context, db DB, schema string) ([]*Enum, error)

PostgresEnums 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 represents a enum value.

func PostgresEnumValues

func PostgresEnumValues(ctx context.Context, db DB, schema, enum string) ([]*EnumValue, error)

PostgresEnumValues runs a custom query, returning results as EnumValue.

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.

func (Error) Error

func (err Error) Error() string

Error satisfies the error interface.

type ForeignKey

type ForeignKey struct {
	ForeignKeyName string `json:"foreign_key_name"` // foreign_key_name
	ColumnName     string `json:"column_name"`      // column_name
	RefIndexName   string `json:"ref_index_name"`   // ref_index_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
	SeqNo          int    `json:"seq_no"`           // seq_no
}

ForeignKey represents a foreign key.

func MysqlTableForeignKeys

func MysqlTableForeignKeys(ctx context.Context, db DB, schema, table string) ([]*ForeignKey, error)

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, 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
	SeqNo     int    `json:"seq_no"`     // seq_no
	Origin    string `json:"origin"`     // origin
	IsPartial bool   `json:"is_partial"` // is_partial
}

Index represents an index.

func MysqlTableIndexes

func MysqlTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)

MysqlTableIndexes runs a custom query, returning results as Index.

func OracleTableIndexes

func OracleTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)

OracleTableIndexes runs a custom query, returning results as Index.

func PostgresTableIndexes

func PostgresTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)

PostgresTableIndexes runs a custom query, returning results as Index.

func Sqlite3TableIndexes

func Sqlite3TableIndexes(ctx context.Context, db DB, table string) ([]*Index, error)

Sqlite3TableIndexes runs a custom query, returning results as Index.

func SqlserverTableIndexes

func SqlserverTableIndexes(ctx context.Context, db DB, schema, table string) ([]*Index, error)

SqlserverTableIndexes 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 represents index column info.

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

func PostgresIndexColumns(ctx context.Context, db DB, schema, index string) ([]*IndexColumn, error)

PostgresIndexColumns runs a custom query, returning results as IndexColumn.

func Sqlite3IndexColumns

func Sqlite3IndexColumns(ctx context.Context, db DB, 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.[custom mysql_enum_value]'.

func MysqlEnumValues

func MysqlEnumValues(ctx context.Context, db DB, schema, enum string) (*MysqlEnumValue, error)

MysqlEnumValues runs a custom query, returning results as MysqlEnumValue.

type PostgresColOrder

type PostgresColOrder struct {
	Ord string `json:"ord"` // ord
}

PostgresColOrder represents 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 {
	ProcName   string `json:"proc_name"`   // proc_name
	ReturnType string `json:"return_type"` // return_type
}

Proc represents a stored procedure.

func MysqlProcs

func MysqlProcs(ctx context.Context, db DB, schema string) ([]*Proc, error)

MysqlProcs runs a custom query, returning results as Proc.

func PostgresProcs

func PostgresProcs(ctx context.Context, db DB, schema string) ([]*Proc, error)

PostgresProcs runs a custom query, returning results as Proc.

type ProcParam

type ProcParam struct {
	ParamType string `json:"param_type"` // param_type
}

ProcParam represents a stored procedure param.

func MysqlProcParams

func MysqlProcParams(ctx context.Context, db DB, schema, proc string) ([]*ProcParam, error)

MysqlProcParams runs a custom query, returning results as ProcParam.

func PostgresProcParams

func PostgresProcParams(ctx context.Context, db DB, schema, proc string) ([]*ProcParam, error)

PostgresProcParams runs a custom query, returning results as ProcParam.

type Sequence

type Sequence struct {
	TableName string `json:"table_name"` // table_name
}

Sequence represents a row from 'public.[custom sequence]'.

func MysqlSequences

func MysqlSequences(ctx context.Context, db DB, schema string) ([]*Sequence, error)

MysqlSequences runs a custom query, returning results as Sequence.

func PostgresSequences

func PostgresSequences(ctx context.Context, db DB, schema string) ([]*Sequence, error)

PostgresSequences runs a custom query, returning results as Sequence.

func Sqlite3Sequences

func Sqlite3Sequences(ctx context.Context, db DB) ([]*Sequence, error)

Sqlite3Sequences runs a custom query, returning results as Sequence.

type SqlserverIdentity

type SqlserverIdentity struct {
	TableName string `json:"table_name"` // table_name
}

SqlserverIdentity represents a row from 'dbo.[custom sqlserver_identity]'.

func SqlserverIdentities

func SqlserverIdentities(ctx context.Context, db DB, schema string) ([]*SqlserverIdentity, error)

SqlserverIdentities runs a custom query, returning results as SqlserverIdentity.

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.

func (StringSlice) Value

func (ss StringSlice) Value() (driver.Value, error)

Value satisfies the sql/driver.Valuer interface.

type Table

type Table struct {
	Type      string `json:"type"`       // type
	TableName string `json:"table_name"` // table_name
	ManualPk  bool   `json:"manual_pk"`  // manual_pk
}

Table represents table info.

func MysqlTables

func MysqlTables(ctx context.Context, db DB, schema, kind string) ([]*Table, error)

MysqlTables runs a custom query, returning results as Table.

func OracleTables

func OracleTables(ctx context.Context, db DB, schema, kind string) ([]*Table, error)

OracleTables runs a custom query, returning results as Table.

func PostgresTables

func PostgresTables(ctx context.Context, db DB, schema, kind string) ([]*Table, error)

PostgresTables runs a custom query, returning results as Table.

func Sqlite3Tables

func Sqlite3Tables(ctx context.Context, db DB, kind string) ([]*Table, error)

Sqlite3Tables runs a custom query, returning results as Table.

func SqlserverTables

func SqlserverTables(ctx context.Context, db DB, schema, kind string) ([]*Table, error)

SqlserverTables runs a custom query, returning results as Table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL