models

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2017 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package models contains the types for schema 'public'.

Package models contains the types for schema 'public'.

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 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 Unit

type Unit struct {
	ID        uuid.UUID `json:"id"`         // id
	ClassID   uuid.UUID `json:"class_id"`   // class_id
	Title     string    `json:"title"`      // title
	CreatedAt time.Time `json:"created_at"` // created_at
	// contains filtered or unexported fields
}

Unit represents a row from 'public.units'.

func UnitByID

func UnitByID(db XODB, id uuid.UUID) (*Unit, error)

UnitByID retrieves a row from 'public.units' as a Unit.

Generated from index 'units_pkey'.

func UnitsByClassID

func UnitsByClassID(db XODB, classID uuid.UUID) ([]*Unit, error)

UnitsByClassID retrieves a row from 'public.units' as a Unit.

Generated from index 'units_class_id_idx'.

func (*Unit) Delete

func (u *Unit) Delete(db XODB) error

Delete deletes the Unit from the database.

func (*Unit) Deleted

func (u *Unit) Deleted() bool

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

func (*Unit) Exists

func (u *Unit) Exists() bool

Exists determines if the Unit exists in the database.

func (*Unit) Insert

func (u *Unit) Insert(db XODB) error

Insert inserts the Unit to the database.

func (*Unit) Save

func (u *Unit) Save(db XODB) error

Save saves the Unit to the database.

func (*Unit) Update

func (u *Unit) Update(db XODB) error

Update updates the Unit in the database.

func (*Unit) Upsert

func (u *Unit) Upsert(db XODB) error

Upsert performs an upsert for Unit.

NOTE: PostgreSQL 9.5+ only

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