postgres

package module
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: Apache-2.0 Imports: 15 Imported by: 5

README

Postgres

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(ctx fns.Context, cond *Conditions, table Table) (v int, err errors.CodeError)

func Delete

func Delete(ctx fns.Context, row interface{}) (err errors.CodeError)

func Exist

func Exist(ctx fns.Context, cond *Conditions, table Table) (has bool, err errors.CodeError)

func Insert

func Insert(ctx fns.Context, row interface{}) (err errors.CodeError)

func InsertOrUpdate

func InsertOrUpdate(ctx fns.Context, row interface{}) (err errors.CodeError)

func InsertWhenExist

func InsertWhenExist(ctx fns.Context, row interface{}, source Select) (err errors.CodeError)

func InsertWhenNotExist

func InsertWhenNotExist(ctx fns.Context, row interface{}, source Select) (err errors.CodeError)

func LitValue

func LitValue(v string) *lit

func Modify

func Modify(ctx fns.Context, row interface{}) (err errors.CodeError)

func Query

func Query(ctx fns.Context, cond *Conditions, rows interface{}) (fetched bool, err errors.CodeError)

func QueryDirect

func QueryDirect(ctx fns.Context, query string, args *sql.Tuple, rows interface{}) (fetched bool, err error)

func QueryOne

func QueryOne(ctx fns.Context, cond *Conditions, row interface{}) (fetched bool, err errors.CodeError)

func QueryWithRange

func QueryWithRange(ctx fns.Context, cond *Conditions, orders *Orders, rng *Range, rows interface{}) (fetched bool, err errors.CodeError)

Types

type Condition

type Condition struct {
	Column    string
	Operation string
	Values    []interface{}
}

func Between

func Between(column string, left interface{}, right interface{}) *Condition

func Eq

func Eq(column string, value interface{}) *Condition

func GT

func GT(column string, value interface{}) *Condition

func GTE

func GTE(column string, value interface{}) *Condition

func IN

func IN(column string, value interface{}) *Condition

func LT

func LT(column string, value interface{}) *Condition

func LTE

func LTE(column string, value interface{}) *Condition

func Like

func Like(column string, value string) *Condition

func LikeLeft

func LikeLeft(column string, value string) *Condition

func LikeRight

func LikeRight(column string, value string) *Condition

func NotDeleted

func NotDeleted(deletedByColumnName string) *Condition

func NotEq

func NotEq(column string, value interface{}) *Condition

type Conditions

type Conditions struct {
	// contains filtered or unexported fields
}

func NewConditions

func NewConditions(cond *Condition) *Conditions

func (*Conditions) And

func (c *Conditions) And(v *Condition) *Conditions

func (*Conditions) AndConditions

func (c *Conditions) AndConditions(v *Conditions) *Conditions

func (*Conditions) Or

func (c *Conditions) Or(v *Condition) *Conditions

func (*Conditions) OrConditions

func (c *Conditions) OrConditions(v *Conditions) *Conditions

func (*Conditions) QueryAndArguments

func (c *Conditions) QueryAndArguments() (query string, args *sql.Tuple)

type LoadMakeupHook added in v0.10.2

type LoadMakeupHook interface {
	Makeup(ctx fns.Context) (err errors.CodeError)
}

type Order

type Order struct {
	Column string
	Desc   bool
}

func Asc

func Asc(column string) *Order

func Desc

func Desc(column string) *Order

type Orders

type Orders struct {
	// contains filtered or unexported fields
}

func NewOrders

func NewOrders() *Orders

func (*Orders) Asc

func (o *Orders) Asc(column string) *Orders

func (*Orders) Desc

func (o *Orders) Desc(column string) *Orders

type PageInfo

type PageInfo struct {
	No    int
	Num   int
	Total int
}

func Page

func Page(ctx fns.Context, cond *Conditions, orders *Orders, pageNo int, pageSize int, rows interface{}) (page *PageInfo, err errors.CodeError)

func (*PageInfo) Empty

func (p *PageInfo) Empty() bool

type Range

type Range struct {
	Offset int
	Limit  int
}

func NewRange

func NewRange(offset int, limit int) *Range

type Select

type Select interface {
	Build(args *sql.Tuple) (query string)
}

func LitSelect

func LitSelect(query string) Select

type Table

type Table interface {
	TableName() (schema string, table string)
}

Jump to

Keyboard shortcuts

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