repository

package
v0.0.0-...-b351023 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUniqueViolation = Error("unique constraint violation")
	ErrNoResults       = Error("no results found")
)
View Source
const (
	OrderDirectionAsc           = OrderDirection(`ASC`)
	OrderDirectionAscNullsFirst = OrderDirection(`ASC NULLS FIRST`)
	OrderDirectionDesc          = OrderDirection(`DESC`)
	OrderDirectionDescNullsLast = OrderDirection(`DESC NULLS LAST`)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DistinctOption

type DistinctOption interface {
	GetDistinct() string
}

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type GroupOption

type GroupOption interface {
	GetGroup() string
}

type HavingOption

type HavingOption interface {
	WhereOption
	GetHaving(start int) (stmt string, args []interface{})
}

type Join

type Join struct {
	Type  string
	Table string
	On    string
}

func (*Join) Build

func (j *Join) Build() string

type JoinOption

type JoinOption interface {
	GetJoin() []Join
}
type Link struct {
	// contains filtered or unexported fields
}
func NewLink(ctx context.Context) *Link

func (*Link) Delete

func (r *Link) Delete(ctx context.Context, link *model.Link) error

func (*Link) Distinct

func (r *Link) Distinct(options ...DistinctOption) *Link

func (*Link) Get

func (r *Link) Get(ctx context.Context) ([]model.Link, error)

func (*Link) GetCount

func (r *Link) GetCount(ctx context.Context) (int, error)

func (*Link) GetMap

func (r *Link) GetMap(ctx context.Context) (map[int64]model.Link, error)

func (*Link) GetOne

func (r *Link) GetOne(ctx context.Context) (*model.Link, error)

func (*Link) Insert

func (r *Link) Insert(ctx context.Context, link *model.Link) error

func (*Link) Limit

func (r *Link) Limit(limit int) *Link

func (*Link) Offset

func (r *Link) Offset(offset int) *Link

func (*Link) Order

func (r *Link) Order(options ...OrderOption) *Link

func (*Link) Update

func (r *Link) Update(ctx context.Context, link *model.Link) error

func (*Link) Where

func (r *Link) Where(options ...WhereOption) *Link

func (*Link) WithDeleted

func (r *Link) WithDeleted(include bool) *Link

type LinkOrderCreatedAt

type LinkOrderCreatedAt OrderDirection

func (LinkOrderCreatedAt) GetOrder

func (o LinkOrderCreatedAt) GetOrder() string

type LinkWhereCreatedAtBefore

type LinkWhereCreatedAtBefore time.Time

func (LinkWhereCreatedAtBefore) GetWhere

func (o LinkWhereCreatedAtBefore) GetWhere(start int) (stmt string, args []interface{})

type LinkWhereID

type LinkWhereID []int64

func (LinkWhereID) GetWhere

func (o LinkWhereID) GetWhere(start int) (stmt string, args []interface{})

type LinkWhereShort

type LinkWhereShort []string

func (LinkWhereShort) GetWhere

func (o LinkWhereShort) GetWhere(start int) (stmt string, args []interface{})

type OrderDirection

type OrderDirection string

type OrderOption

type OrderOption interface {
	GetOrder() string
}

type QueryOptions

type QueryOptions struct {
	Distinct  []string
	Join      []Join
	Where     []string
	Group     []string
	Having    []string
	Order     []string
	Limit     *int
	Offset    *int
	Arguments []interface{}
}

func (*QueryOptions) AddDistinct

func (q *QueryOptions) AddDistinct(options ...DistinctOption)

func (*QueryOptions) AddOrder

func (q *QueryOptions) AddOrder(options ...OrderOption)

func (*QueryOptions) AddWhere

func (q *QueryOptions) AddWhere(options ...WhereOption)

func (*QueryOptions) BuildDistinct

func (q *QueryOptions) BuildDistinct() string

func (*QueryOptions) BuildGroup

func (q *QueryOptions) BuildGroup() string

func (*QueryOptions) BuildHaving

func (q *QueryOptions) BuildHaving() string

func (*QueryOptions) BuildJoin

func (q *QueryOptions) BuildJoin() string

func (*QueryOptions) BuildLimit

func (q *QueryOptions) BuildLimit() string

func (*QueryOptions) BuildOrder

func (q *QueryOptions) BuildOrder() string

func (*QueryOptions) BuildWhere

func (q *QueryOptions) BuildWhere() string

func (*QueryOptions) SetLimit

func (q *QueryOptions) SetLimit(limit int)

func (*QueryOptions) SetOffset

func (q *QueryOptions) SetOffset(offset int)

type WhereOption

type WhereOption interface {
	GetWhere(start int) (stmt string, args []interface{})
}

Jump to

Keyboard shortcuts

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