Documentation ¶
Overview ¶
Package models contains the types for schema 'booktest'.
Package models contains the types for schema 'booktest'.
Package models contains the types for schema 'booktest'.
Package models contains the types for schema 'booktest'.
Package models contains the types for schema 'booktest'.
Package models contains the types for schema 'booktest'.
Index ¶
Constants ¶
const ( // BookTypeFiction is the 'FICTION' BookType. BookTypeFiction = BookType(1) // BookTypeNonfiction is the 'NONFICTION' BookType. BookTypeNonfiction = BookType(2) )
Variables ¶
var XOLog = func(string, ...interface{}) {}
XOLog provides the log func used by generated queries.
Functions ¶
Types ¶
type Author ¶
type Author struct { AuthorID int `json:"author_id"` // author_id Name string `json:"name"` // name // contains filtered or unexported fields }
Author represents a row from 'booktest.authors'.
func AuthorByAuthorID ¶
AuthorByAuthorID retrieves a row from 'booktest.authors' as a Author.
Generated from index 'authors_author_id_pkey'.
func AuthorsByName ¶
AuthorsByName retrieves a row from 'booktest.authors' as a Author.
Generated from index 'authors_name_idx'.
func (*Author) Deleted ¶
Deleted provides information if the Author has been deleted from the database.
type AuthorBookResult ¶
type AuthorBookResult struct { AuthorID int // author_id AuthorName string // author_name BookID int // book_id BookIsbn string // book_isbn BookTitle string // book_title BookTags string // book_tags }
AuthorBookResult is the result of a search.
func AuthorBookResultsByTag ¶
func AuthorBookResultsByTag(db XODB, tag string) ([]*AuthorBookResult, error)
AuthorBookResultsByTag runs a custom query, returning results as AuthorBookResult.
type Book ¶
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:"book_type"` // book_type Title string `json:"title"` // title Year int `json:"year"` // year Available *time.Time `json:"available"` // available Tags string `json:"tags"` // tags // contains filtered or unexported fields }
Book represents a row from 'booktest.books'.
func BookByBookID ¶
BookByBookID retrieves a row from 'booktest.books' as a Book.
Generated from index 'books_book_id_pkey'.
func BookByIsbn ¶
BookByIsbn retrieves a row from 'booktest.books' as a Book.
Generated from index 'isbn'.
func BooksByAuthorID ¶
BooksByAuthorID retrieves a row from 'booktest.books' as a Book.
Generated from index 'author_id'.
func BooksByTitle ¶
BooksByTitle retrieves a row from 'booktest.books' as a Book.
Generated from index 'books_title_idx'.
func (*Book) Author ¶
Author returns the Author associated with the Book's AuthorID (author_id).
Generated from foreign key 'books_ibfk_1'.
type BookType ¶
type BookType uint16
BookType is the 'book_type' enum type from schema 'booktest'.
func (BookType) MarshalText ¶
MarshalText marshals BookType into text.
func (*BookType) UnmarshalText ¶
UnmarshalText unmarshals BookType from text.
type ScannerValuer ¶
ScannerValuer is the common interface for types that implement both the database/sql.Scanner and sql/driver.Valuer interfaces.
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.
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 'booktest'.
This should work with database/sql.DB and database/sql.Tx.