books

package
v0.0.0-...-37c7f33 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TableName = "books"

TableName is the primary table that this particular gnormed file deals with.

Variables

View Source
var (
	AuthorIDCol  generated.UuidUUIDField      = "author_id"
	AvailableCol generated.TimeTimeField      = "available"
	BooktypeCol  enum.BookTypeField           = "booktype"
	IDCol        generated.IntField           = "id"
	IsbnCol      generated.StringField        = "isbn"
	PagesCol     generated.IntField           = "pages"
	SummaryCol   generated.SqlNullStringField = "summary"
	TitleCol     generated.StringField        = "title"
)

Field values for every column in Books.

Functions

func AppendInt64

func AppendInt64(ctx context.Context, db generated.DB, name string, value interface{}, where generated.WhereClause) (int64, error)

AppendInt64 adds a value to a field

func CountQuery

func CountQuery(ctx context.Context, db gnorm.DB, where gnorm.WhereClause) (int, error)

CountQuery retrieve one row from 'books'.

func Delete

func Delete(ctx context.Context,
	db generated.DB,
	id int,
) (int64, error)

Delete deletes the Row from the database. Returns the number of items deleted.

func DeleteAll

func DeleteAll(ctx context.Context, db generated.DB) (int64, error)

DeleteAll deletes all Rows from the database and returns the number of rows deleted.

func DeleteWhere

func DeleteWhere(ctx context.Context, db generated.DB, where generated.WhereClause) (int64, error)

DeleteWhere deletes Rows from the database and returns the number of rows deleted.

func Inc

Inc increments the value of a single column on an existing row in the database.

func Insert

func Insert(ctx context.Context, db generated.DB, r *Row) error

Insert inserts the row into the database.

func InsertIgnore

func InsertIgnore(ctx context.Context, db gnorm.DB, r *Row, constraint string) error

InsertIgnore inserts the row into the database but ignores conflicts

func Set

Set sets a single column on an existing row in the database.

func Upsert

func Upsert(ctx context.Context, db generated.DB, r *Row) error

Upsert performs an insert-or-update in one DB call for Books. Unlike insert, upsert requires that you have set any IDs on the row you're upserting. NOTE: PostgreSQL 9.5+ only

Types

type Row

type Row struct {
	ID        int            // id (PK)
	AuthorID  uuid.UUID      // author_id
	Available time.Time      // available
	Booktype  enum.BookType  // booktype
	Isbn      string         // isbn
	Pages     int            // pages
	Summary   sql.NullString // summary
	Title     string         // title
}

Row represents a row from 'books'.

func All

func All(ctx context.Context, db generated.DB) ([]*Row, error)

All retrieves all rows from 'books' as a slice of Row.

func Find

func Find(ctx context.Context, db generated.DB,
	id int,
) (*Row, error)

Find retrieves a row from 'books' by its primary key(s).

func First

func First(ctx context.Context, db generated.DB, where generated.WhereClause, orderby generated.OrderBy) (*Row, error)

First retrieve one row from 'books' when sorted by orderby.

func One

func One(ctx context.Context, db generated.DB, where generated.WhereClause) (*Row, error)

One retrieve one row from 'books'.

func Query

func Query(ctx context.Context, db generated.DB, where generated.WhereClause) ([]*Row, error)

Query retrieves rows from 'books' as a slice of Row.

func QueryOrder

func QueryOrder(ctx context.Context, db generated.DB, where generated.WhereClause, orderby generated.OrderBy) ([]*Row, error)

QueryOrder retrieves rows from 'books' as a slice of Row in a particular order.

Jump to

Keyboard shortcuts

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