models

package
v0.0.0-...-148dfbe Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

generated by forge -type=ExampleType; DO NOT EDIT

Index

Constants

This section is empty.

Variables

View Source
var ErrExampleTypeInvalid = errors.New("ExampleType is invalid")

Functions

func CreateCustomDocumentQ

func CreateCustomDocumentQ() (*customDocumentQ, error)

Types

type BuzzFeed

type BuzzFeed struct {
	ID          int64       `db:"id" json:"id"`
	Name        string      `db:"name" json:"name"`
	BuzzType    ExampleType `db:"buzz_type" json:"buzzType"`
	Description string      `db:"description" json:"description"`
	Details     Feed        `db:"details" json:"details"`
	CreatedAt   int64       `db:"created_at" json:"createdAt"`
	UpdatedAt   int64       `db:"updated_at" json:"updatedAt"`
}

type BuzzFeedQI

type BuzzFeedQI interface {
	// Insert adds new `BuzzFeed` record to `buzzFeeds` table.
	Insert(buzzFeed *BuzzFeed) error
	// Update updates row with passed `uid`.
	Update(id int64, buzzFeed *BuzzFeed) error
	// UpdateBuzzDescription sets new value of
	// `description` column for row with passed `uid`.
	UpdateBuzzDescription(id int64, description string) error
	// DeleteByID deletes row with passed `id`.
	DeleteByID(id int64) error

	// WithID adds filter by `ID` column.
	WithID(ID int64) BuzzFeedQI
	// WithName adds filter by `Name` column.
	WithName(Name string) BuzzFeedQI
	// WithBuzzType adds filter by `BuzzType` column.
	WithBuzzType(BuzzType ExampleType) BuzzFeedQI
	// WithDescription adds filter by `Description` column.
	WithDescription(Description string) BuzzFeedQI
	// WithDetails adds filter by `Details` column.
	WithDetails(Details Feed) BuzzFeedQI
	// WithCreatedAt adds filter by `CreatedAt` column.
	WithCreatedAt(CreatedAt int64) BuzzFeedQI
	// WithUpdatedAt adds filter by `UpdatedAt` column.
	WithUpdatedAt(UpdatedAt int64) BuzzFeedQI

	// Get returns first row of the result of query execution.
	Get() (*BuzzFeed, error)
	// Select returns all records of the result of query execution.
	Select() ([]BuzzFeed, error)
	// GetByID returns one row with passed `id`.
	GetByID(id int64) (*BuzzFeed, error)

	// Until sets lower time bound.
	Since(timestamp int64) BuzzFeedQI
	// Until sets upper time bound.
	Until(timestamp int64) BuzzFeedQI
	// SetPage applies pagination parameters.
	SetPage(pq *db.PageQuery) BuzzFeedQI
}

type CustomDocument

type CustomDocument struct {
	Id         int64  `json:"id"`
	FirstName  string `json:"firstName"`
	SecondName string `json:"secondName"`
	cdb.Document
}

type ExampleType

type ExampleType int

func (ExampleType) MarshalJSON

func (r ExampleType) MarshalJSON() ([]byte, error)

MarshalJSON is generated so ExampleType satisfies json.Marshaler.

func (*ExampleType) Scan

func (r *ExampleType) Scan(src interface{}) error

Value is generated so ExampleType satisfies db row driver.Scanner.

func (ExampleType) String

func (r ExampleType) String() string

String is generated so ExampleType satisfies fmt.Stringer.

func (*ExampleType) UnmarshalJSON

func (r *ExampleType) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so ExampleType satisfies json.Unmarshaler.

func (ExampleType) Validate

func (r ExampleType) Validate() error

Validate verifies that value is predefined for ExampleType.

func (ExampleType) Value

func (r ExampleType) Value() (driver.Value, error)

Value is generated so ExampleType satisfies db row driver.Valuer.

type Feed

type Feed struct {
}

func (Feed) MarshalJSON

func (f Feed) MarshalJSON() ([]byte, error)

func (*Feed) Scan

func (f *Feed) Scan(src interface{}) error

func (*Feed) UnmarshalJSON

func (f *Feed) UnmarshalJSON(data []byte) error

func (Feed) Value

func (f Feed) Value() (driver.Value, error)

type Q

type Q struct {
	*db.SQLConn
}

Q implementation of the `QI` interface.

func NewQ

func NewQ(dbConn *db.SQLConn) *Q

NewQ returns initialized instance of the `QI`.

func (*Q) BuzzFeed

func (q *Q) BuzzFeed() BuzzFeedQI

type QI

type QI interface {
	db.Transactional

	BuzzFeed() BuzzFeedQI
}

QI is a top level interface for interaction with database.

Jump to

Keyboard shortcuts

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