provider

package
v0.0.0-...-2b7dfc1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Equal            = "Equal"
	LessThan         = "LessThan"
	GreaterThan      = "GreaterThan"
	GreaterThanEqual = "GreaterThanEqual"
	LessThanEqual    = "LessThanEqual"
	JSON             = "JSON"

	Descending = "Descending"
	Ascending  = "Ascending"
)

Variables

This section is empty.

Functions

func Close

func Close(db *gorm.DB) error

func Ping

func Ping(db *gorm.DB) error

func Reset

func Reset()

func TranslateQuery

func TranslateQuery(db *gorm.DB, query *Query) *gorm.DB

Types

type Filter

type Filter struct {
	Condition string
	Field     string
	Value     interface{}
}

func NewFilter

func NewFilter(field, condition string, value interface{}) *Filter

NewFilter creates a new property filter

type Ordering

type Ordering struct {
	Field     string
	Direction string
}

func NewOrdering

func NewOrdering(field, direction string) *Ordering

type Postgres

type Postgres struct {
	DatabaseName string
	Address      string
	Username     string
	Password     string
	MaxIdleConn  int
	MaxOpenConn  int
	LogEnabled   bool
}

func (Postgres) Client

func (p Postgres) Client() (*gorm.DB, error)

type Query

type Query struct {
	Model     string
	Limit     int
	Offset    int
	Filters   []*Filter
	Orderings []*Ordering
}

func NewQuery

func NewQuery(model string) *Query

func (*Query) Filter

func (q *Query) Filter(property, condition string, value interface{}) *Query

Filter adds a filter to the query

func (*Query) Ordering

func (q *Query) Ordering(property, direction string) *Query

Order adds a sort order to the query

func (*Query) Slice

func (q *Query) Slice(offset, limit int) *Query

Jump to

Keyboard shortcuts

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