models

package
v0.0.0-...-fd69b6f Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package models contains the types for schema ”.

Package models contains the types for schema ”.

Package models contains the types for schema ”.

Package models contains the types for schema ”.

Index

Constants

This section is empty.

Variables

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

XOLog provides the log func used by generated queries.

Functions

This section is empty.

Types

type Author

type Author struct {
	AuthorID int    // author_id
	Name     string // name
	// contains filtered or unexported fields
}

Author represents a row from 'authors'.

func AuthorByAuthorID

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

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

Generated from index 'authors_author_id_pkey'.

func AuthorsByName

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

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

Generated from index 'authors_name_idx'.

func (*Author) Delete

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

Delete deletes the Author from the database.

func (*Author) Deleted

func (a *Author) Deleted() bool

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

func (*Author) Exists

func (a *Author) Exists() bool

Exists determines if the Author exists in the database.

func (*Author) Insert

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

Insert inserts the Author to the database.

func (*Author) Save

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

Save saves the Author to the database.

func (*Author) Update

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

Update updates the Author in 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    // book_id
	AuthorID  int    // author_id
	Isbn      string // isbn
	Title     string // title
	Year      int    // year
	Available string // available
	Tags      string // tags
	// contains filtered or unexported fields
}

Book represents a row from 'books'.

func BookByBookID

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

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

Generated from index 'books_book_id_pkey'.

func BookByIsbn

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

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

Generated from index 'sqlite_autoindex_books_1'.

func BooksByTitleYear

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

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

Generated from index 'books_title_idx'.

func (*Book) Author

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

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

Delete deletes the Book from the database.

func (*Book) Deleted

func (b *Book) Deleted() bool

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

func (*Book) Exists

func (b *Book) Exists() bool

Exists determines if the Book exists in the database.

func (*Book) Insert

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

Insert inserts the Book to the database.

func (*Book) Save

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

Save saves the Book to the database.

func (*Book) Update

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

Update updates the Book in the database.

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 Slice

type Slice []ScannerValuer

Slice is a slice of ScannerValuers.

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 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 ”.

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