models

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'xodb'.

Package models contains the types for schema 'xodb'.

Package models contains the types for schema 'xodb'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Package models contains the types for schema ”.

Package models contains the types for schema ”.

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

Index

Constants

View Source
const (
	// BookTypeFiction is the 'FICTION' BookType.
	BookTypeFiction = BookType(1)

	// BookTypeNonfiction is the 'NONFICTION' BookType.
	BookTypeNonfiction = BookType(2)
)

Variables

View Source
var XOLog = func(string, ...interface{}) {}

XOLog provides the log func used by generated queries.

Functions

func SayHello added in v1.1.0

func SayHello(db XODB, v0 string) (string, error)

SayHello calls the stored procedure 'public.say_hello(text) text' on db.

Types

type Author added in v1.1.0

type Author struct {
	AuthorID int            `json:"author_id"` // author_id
	Name     string         `json:"name"`      // name
	Country  sql.NullString `json:"country"`   // country
	// contains filtered or unexported fields
}

Author represents a row from 'public.authors'.

func AuthorByAuthorID added in v1.1.0

func AuthorByAuthorID(db XODB, authorID int) (*Author, error)

AuthorByAuthorID retrieves a row from 'public.authors' as a Author.

Generated from index 'authors_pkey'.

func AuthorByName added in v1.1.0

func AuthorByName(db XODB, name string) (*Author, error)

AuthorByName retrieves a row from 'public.authors' as a Author.

Generated from index 'authors_name_key'.

func AuthorsByName added in v1.1.0

func AuthorsByName(db XODB, name string) ([]*Author, error)

AuthorsByName retrieves a row from 'public.authors' as a Author.

Generated from index 'authors_name_idx'.

func (*Author) Delete added in v1.1.0

func (a *Author) Delete(db XODB) error

Delete deletes the Author from the database.

func (*Author) Deleted added in v1.1.0

func (a *Author) Deleted() bool

Deleted provides information if the Author has been deleted from the database.

func (*Author) Exists added in v1.1.0

func (a *Author) Exists() bool

Exists determines if the Author exists in the database.

func (*Author) Insert added in v1.1.0

func (a *Author) Insert(db XODB) error

Insert inserts the Author to the database.

func (*Author) Save added in v1.1.0

func (a *Author) Save(db XODB) error

Save saves the Author to the database.

func (*Author) Update added in v1.1.0

func (a *Author) Update(db XODB) error

Update updates the Author in the database.

func (*Author) Upsert added in v1.1.0

func (a *Author) Upsert(db XODB) error

Upsert performs an upsert for Author.

NOTE: PostgreSQL 9.5+ only

type Book added in v1.1.0

type Book struct {
	BookID    int         `json:"book_id"`   // book_id
	AuthorID  int         `json:"author_id"` // author_id
	Isbn      string      `json:"isbn"`      // isbn
	Booktype  BookType    `json:"booktype"`  // booktype
	Title     string      `json:"title"`     // title
	Year      int         `json:"year"`      // year
	Available time.Time   `json:"available"` // available
	Tags      StringSlice `json:"tags"`      // tags
	// contains filtered or unexported fields
}

Book represents a row from 'public.books'.

func BookByBookID added in v1.1.0

func BookByBookID(db XODB, bookID int) (*Book, error)

BookByBookID retrieves a row from 'public.books' as a Book.

Generated from index 'books_pkey'.

func BookByIsbn added in v1.1.0

func BookByIsbn(db XODB, isbn string) (*Book, error)

BookByIsbn retrieves a row from 'public.books' as a Book.

Generated from index 'books_isbn_key'.

func BooksByTitle added in v1.1.0

func BooksByTitle(db XODB, title string) ([]*Book, error)

BooksByTitle retrieves a row from 'public.books' as a Book.

Generated from index 'books_title_lower_idx'.

func BooksByTitleYear added in v1.1.0

func BooksByTitleYear(db XODB, title string, year int) ([]*Book, error)

BooksByTitleYear retrieves a row from 'public.books' as a Book.

Generated from index 'books_title_idx'.

func (*Book) Author added in v1.1.0

func (b *Book) Author(db XODB) (*Author, error)

Author returns the Author associated with the Book's AuthorID (author_id).

Generated from foreign key 'books_author_id_fkey'.

func (*Book) Delete added in v1.1.0

func (b *Book) Delete(db XODB) error

Delete deletes the Book from the database.

func (*Book) Deleted added in v1.1.0

func (b *Book) Deleted() bool

Deleted provides information if the Book has been deleted from the database.

func (*Book) Exists added in v1.1.0

func (b *Book) Exists() bool

Exists determines if the Book exists in the database.

func (*Book) Insert added in v1.1.0

func (b *Book) Insert(db XODB) error

Insert inserts the Book to the database.

func (*Book) Save added in v1.1.0

func (b *Book) Save(db XODB) error

Save saves the Book to the database.

func (*Book) Update added in v1.1.0

func (b *Book) Update(db XODB) error

Update updates the Book in the database.

func (*Book) Upsert added in v1.1.0

func (b *Book) Upsert(db XODB) error

Upsert performs an upsert for Book.

NOTE: PostgreSQL 9.5+ only

type BookType added in v1.1.0

type BookType uint16

BookType is the 'book_type' enum type from schema 'public'.

func (BookType) MarshalText added in v1.1.0

func (bt BookType) MarshalText() ([]byte, error)

MarshalText marshals BookType into text.

func (*BookType) Scan added in v1.1.0

func (bt *BookType) Scan(src interface{}) error

Scan satisfies the database/sql.Scanner interface for BookType.

func (BookType) String added in v1.1.0

func (bt BookType) String() string

String returns the string value of the BookType.

func (*BookType) UnmarshalText added in v1.1.0

func (bt *BookType) UnmarshalText(text []byte) error

UnmarshalText unmarshals BookType from text.

func (BookType) Value added in v1.1.0

func (bt BookType) Value() (driver.Value, error)

Value satisfies the sql/driver.Valuer interface for BookType.

type Column

type Column struct {
	FieldOrdinal int            // field_ordinal
	ColumnName   string         // column_name
	DataType     string         // data_type
	NotNull      bool           // not_null
	DefaultValue sql.NullString // default_value
	IsPrimaryKey bool           // is_primary_key
}

Column represents column info.

func MsTableColumns

func MsTableColumns(db XODB, schema string, table string) ([]*Column, error)

MsTableColumns runs a custom query, returning results as Column.

func MyTableColumns

func MyTableColumns(db XODB, schema string, table string) ([]*Column, error)

MyTableColumns runs a custom query, returning results as Column.

func OrTableColumns

func OrTableColumns(db XODB, schema string, table string) ([]*Column, error)

OrTableColumns runs a custom query, returning results as Column.

func PgTableColumns

func PgTableColumns(db XODB, schema string, table string, sys bool) ([]*Column, error)

PgTableColumns runs a custom query, returning results as Column.

type CrAutoincrement

type CrAutoincrement struct {
	TableName string // table_name
}

CrAutoincrement represents a row from '[custom cr_autoincrement]'.

func CrAutoIncrements

func CrAutoIncrements(db XODB, schema string) ([]*CrAutoincrement, error)

CrAutoIncrements runs a custom query, returning results as CrAutoincrement.

type Enum

type Enum struct {
	EnumName string // enum_name
}

Enum represents a enum.

func MyEnums

func MyEnums(db XODB, schema string) ([]*Enum, error)

MyEnums runs a custom query, returning results as Enum.

func PgEnums

func PgEnums(db XODB, schema string) ([]*Enum, error)

PgEnums runs a custom query, returning results as Enum.

type EnumValue

type EnumValue struct {
	EnumValue  string // enum_value
	ConstValue int    // const_value
}

EnumValue represents a enum value.

func PgEnumValues

func PgEnumValues(db XODB, schema string, enum string) ([]*EnumValue, error)

PgEnumValues runs a custom query, returning results as EnumValue.

type ForeignKey

type ForeignKey struct {
	ForeignKeyName string // foreign_key_name
	ColumnName     string // column_name
	RefIndexName   string // ref_index_name
	RefTableName   string // ref_table_name
	RefColumnName  string // ref_column_name
	KeyID          int    // key_id
	SeqNo          int    // seq_no
	OnUpdate       string // on_update
	OnDelete       string // on_delete
	Match          string // match
}

ForeignKey represents a foreign key.

func MsTableForeignKeys

func MsTableForeignKeys(db XODB, schema string, table string) ([]*ForeignKey, error)

MsTableForeignKeys runs a custom query, returning results as ForeignKey.

func MyTableForeignKeys

func MyTableForeignKeys(db XODB, schema string, table string) ([]*ForeignKey, error)

MyTableForeignKeys runs a custom query, returning results as ForeignKey.

func OrTableForeignKeys

func OrTableForeignKeys(db XODB, schema string, table string) ([]*ForeignKey, error)

OrTableForeignKeys runs a custom query, returning results as ForeignKey.

func PgTableForeignKeys

func PgTableForeignKeys(db XODB, schema string, table string) ([]*ForeignKey, error)

PgTableForeignKeys runs a custom query, returning results as ForeignKey.

func SqTableForeignKeys

func SqTableForeignKeys(db XODB, table string) ([]*ForeignKey, error)

SqTableForeignKeys runs a custom query, returning results as ForeignKey.

type Index

type Index struct {
	IndexName string // index_name
	IsUnique  bool   // is_unique
	IsPrimary bool   // is_primary
	SeqNo     int    // seq_no
	Origin    string // origin
	IsPartial bool   // is_partial
}

Index represents an index.

func MsTableIndexes

func MsTableIndexes(db XODB, schema string, table string) ([]*Index, error)

MsTableIndexes runs a custom query, returning results as Index.

func MyTableIndexes

func MyTableIndexes(db XODB, schema string, table string) ([]*Index, error)

MyTableIndexes runs a custom query, returning results as Index.

func OrTableIndexes

func OrTableIndexes(db XODB, schema string, table string) ([]*Index, error)

OrTableIndexes runs a custom query, returning results as Index.

func PgTableIndexes

func PgTableIndexes(db XODB, schema string, table string) ([]*Index, error)

PgTableIndexes runs a custom query, returning results as Index.

func SqTableIndexes

func SqTableIndexes(db XODB, table string) ([]*Index, error)

SqTableIndexes runs a custom query, returning results as Index.

type IndexColumn

type IndexColumn struct {
	SeqNo      int    // seq_no
	Cid        int    // cid
	ColumnName string // column_name
}

IndexColumn represents index column info.

func MsIndexColumns

func MsIndexColumns(db XODB, schema string, table string, index string) ([]*IndexColumn, error)

MsIndexColumns runs a custom query, returning results as IndexColumn.

func MyIndexColumns

func MyIndexColumns(db XODB, schema string, table string, index string) ([]*IndexColumn, error)

MyIndexColumns runs a custom query, returning results as IndexColumn.

func OrIndexColumns

func OrIndexColumns(db XODB, schema string, table string, index string) ([]*IndexColumn, error)

OrIndexColumns runs a custom query, returning results as IndexColumn.

func PgIndexColumns

func PgIndexColumns(db XODB, schema string, index string) ([]*IndexColumn, error)

PgIndexColumns runs a custom query, returning results as IndexColumn.

func SqIndexColumns

func SqIndexColumns(db XODB, index string) ([]*IndexColumn, error)

SqIndexColumns runs a custom query, returning results as IndexColumn.

type MsIdentity

type MsIdentity struct {
	TableName string // table_name
}

MsIdentity represents a row from '[custom ms_identity]'.

func MsIdentities

func MsIdentities(db XODB, schema string) ([]*MsIdentity, error)

MsIdentities runs a custom query, returning results as MsIdentity.

type MyAutoIncrement

type MyAutoIncrement struct {
	TableName string // table_name
}

MyAutoIncrement represents a row from '[custom my_auto_increment]'.

func MyAutoIncrements

func MyAutoIncrements(db XODB, schema string) ([]*MyAutoIncrement, error)

MyAutoIncrements runs a custom query, returning results as MyAutoIncrement.

type MyEnumValue

type MyEnumValue struct {
	EnumValues string // enum_values
}

MyEnumValue represents a row from '[custom my_enum_value]'.

func MyEnumValues

func MyEnumValues(db XODB, schema string, enum string) (*MyEnumValue, error)

MyEnumValues runs a custom query, returning results as MyEnumValue.

type PgColOrder

type PgColOrder struct {
	Ord string // ord
}

PgColOrder represents index column order.

func PgGetColOrder

func PgGetColOrder(db XODB, schema string, index string) (*PgColOrder, error)

PgGetColOrder runs a custom query, returning results as PgColOrder.

type PgGetFuncResExist

type PgGetFuncResExist struct {
	Exists bool // exists
}

PgGetFuncResExist represents a row from '[custom pg_get_func_res_exist]'.

func PgGetFuncResExists

func PgGetFuncResExists(db XODB) ([]*PgGetFuncResExist, error)

PgGetFuncResExists runs a custom query, returning results as PgGetFuncResExist.

type Proc

type Proc struct {
	ProcName   string // proc_name
	ReturnType string // return_type
}

Proc represents a stored procedure.

func MyProcs

func MyProcs(db XODB, schema string) ([]*Proc, error)

MyProcs runs a custom query, returning results as Proc.

func PgProcs

func PgProcs(db XODB, schema string) ([]*Proc, error)

PgProcs runs a custom query, returning results as Proc.

type ProcParam

type ProcParam struct {
	ParamType string // param_type
}

ProcParam represents a stored procedure param.

func MyProcParams

func MyProcParams(db XODB, schema string, proc string) ([]*ProcParam, error)

MyProcParams runs a custom query, returning results as ProcParam.

func PgProcParams

func PgProcParams(db XODB, schema string, proc string) ([]*ProcParam, error)

PgProcParams runs a custom query, returning results as ProcParam.

type ScannerValuer

type ScannerValuer interface {
	sql.Scanner
	driver.Valuer
}

ScannerValuer is the common interface for types that implement both the database/sql.Scanner and sql/driver.Valuer interfaces.

type Sequence

type Sequence struct {
	TableName string // table_name
}

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

func PgSequences

func PgSequences(db XODB, schema string) ([]*Sequence, error)

PgSequences runs a custom query, returning results as Sequence.

type Slice

type Slice []ScannerValuer

Slice is a slice of ScannerValuers.

type SqAutoIncrement

type SqAutoIncrement struct {
	TableName string // table_name
	SQL       string // sql
}

SqAutoIncrement represents a row from '[custom sq_auto_increment]'.

func SqAutoIncrements

func SqAutoIncrements(db XODB) ([]*SqAutoIncrement, error)

SqAutoIncrements runs a custom query, returning results as SqAutoIncrement.

type SqColumn

type SqColumn struct {
	FieldOrdinal int            // field_ordinal
	ColumnName   string         // column_name
	DataType     string         // data_type
	NotNull      bool           // not_null
	DefaultValue sql.NullString // default_value
	PkColIndex   int            // pk_col_index
}

SqColumn represents a row from '[custom sq_column]'.

func SqTableColumns

func SqTableColumns(db XODB, table string) ([]*SqColumn, error)

SqTableColumns runs a custom query, returning results as SqColumn.

type StringSlice

type StringSlice []string

StringSlice is a slice of strings.

func (*StringSlice) Scan

func (ss *StringSlice) Scan(src interface{}) error

Scan satisfies the sql.Scanner interface for StringSlice.

func (StringSlice) Value

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

Value satisfies the driver.Valuer interface for StringSlice.

type Table

type Table struct {
	Type      string // type
	TableName string // table_name
	ManualPk  bool   // manual_pk
}

Table represents table info.

func MsTables

func MsTables(db XODB, schema string, relkind string) ([]*Table, error)

MsTables runs a custom query, returning results as Table.

func MyTables

func MyTables(db XODB, schema string, relkind string) ([]*Table, error)

MyTables runs a custom query, returning results as Table.

func OrTables

func OrTables(db XODB, schema string, relkind string) ([]*Table, error)

OrTables runs a custom query, returning results as Table.

func PgTables

func PgTables(db XODB, schema string, relkind string) ([]*Table, error)

PgTables runs a custom query, returning results as Table.

func SqTables

func SqTables(db XODB, relkind string) ([]*Table, error)

SqTables runs a custom query, returning results as Table.

type XODB

type XODB interface {
	Exec(string, ...interface{}) (sql.Result, error)
	Query(string, ...interface{}) (*sql.Rows, error)
	QueryRow(string, ...interface{}) *sql.Row
}

XODB is the common interface for database operations that can be used with types from schema 'public'.

This should work with database/sql.DB and database/sql.Tx.

Jump to

Keyboard shortcuts

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