query

package module
v0.0.0-...-c876260 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: MIT Imports: 6 Imported by: 0

README

query

WARNING: Prefer to use this complete library: https://upper.io/db.v3/

GoDoc

Golang SQL database queries in a fluent style.

Install

go get github.com/altipla-consulting/query

Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using gofmt.

License

MIT License

Documentation

Index

Constants

View Source
const (
	OrderDirectionDesc = OrderDirection("DESC")
	OrderDirectionAsc  = OrderDirection("ASC")
)

Variables

This section is empty.

Functions

func Between

func Between(column string, valueBefore, valueAfter interface{}) *betweenImpl

func Filter

func Filter(column string, value interface{}) *filterImpl

func LogicOr

func LogicOr(conditions ...Condition) *logicOrImpl

Types

type Condition

type Condition interface {
	SQL() (string, []interface{}, error)
}

type Insert

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

func NewInsert

func NewInsert(table string) *Insert

func (*Insert) Clone

func (q *Insert) Clone() *Insert

func (*Insert) Col

func (q *Insert) Col(column string, value interface{}) *Insert

func (*Insert) Exec

func (q *Insert) Exec(db *sql.DB) (sql.Result, error)

func (*Insert) SQL

func (q *Insert) SQL() (string, []interface{})

type Order

type Order struct {
	Column    string
	Direction OrderDirection
}

func (Order) SQL

func (order Order) SQL() string

type OrderDirection

type OrderDirection string

type Select

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

func NewSelect

func NewSelect(table string) *Select

func (*Select) Clone

func (q *Select) Clone() *Select

func (*Select) Condition

func (q *Select) Condition(condition Condition) *Select

func (*Select) Count

func (q *Select) Count(db *sql.DB) (int64, error)

func (*Select) Filter

func (q *Select) Filter(column string, value interface{}) *Select

func (*Select) GetAll

func (q *Select) GetAll(db *sql.DB, models interface{}) error

func (*Select) IsOrdered

func (q *Select) IsOrdered() bool

func (*Select) Limit

func (q *Select) Limit(limit int64) *Select

func (*Select) Offset

func (q *Select) Offset(offset int64) *Select

func (*Select) Order

func (q *Select) Order(orders ...Order) *Select

func (*Select) Project

func (q *Select) Project(columns ...string) *Select

func (*Select) SQL

func (q *Select) SQL() (string, []interface{}, error)

func (*Select) SortAsc

func (q *Select) SortAsc(column string) *Select

func (*Select) SortDesc

func (q *Select) SortDesc(column string) *Select

Jump to

Keyboard shortcuts

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