builder

package
Version: v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default(value interface{}) interface{}

Types

type Builder

type Builder interface {
	// Builds returns generated SQL and parameters.
	Build() (string, []interface{}, error)
}

Builder interface is implemented by all specialized builders below and is used to generate SQL statements.

func SQL

func SQL(query string, params ...interface{}) Builder

type DefaultValue

type DefaultValue struct{}

func (DefaultValue) String

func (dv DefaultValue) String() string

type Deleter

type Deleter interface {
	Builder
	With(name string, q Builder) Deleter
	Using(using string) Deleter
	Where(where string, params ...interface{}) Deleter
	Returning(returning ...string) Deleter
}

Deleter is a DELETE statement builder.

func Delete

func Delete(table string) Deleter

type Insecter

type Insecter interface {
	Builder
	Columns(col ...string) Insecter
	Values(params ...interface{}) Insecter
	Where(where string, params ...interface{}) Insecter
	Returning(returning ...string) Insecter
}

func Insect

func Insect(table string) Insecter

type Inserter

type Inserter interface {
	Builder
	With(name string, q Builder) Inserter
	Columns(col ...string) Inserter
	Values(params ...interface{}) Inserter
	From(q Selecter) Inserter
	OnConflictDoNothing(target string, params ...interface{}) Inserter
	Returning(returning ...string) Inserter
}

Inserter is an INSERT statement builder.

func Insert

func Insert(table string) Inserter

type Selecter

type Selecter interface {
	Builder
	With(name string, q Builder) Selecter
	Columns(col string, params ...interface{}) Selecter
	From(from string, params ...interface{}) Selecter
	Where(where string, params ...interface{}) Selecter
	Union(all bool, q Selecter) Selecter
	Offset(offset uint64) Selecter
	Limit(limit uint64) Selecter
	Distinct(distinct ...string) Selecter
	GroupBy(groupBy string) Selecter
	Having(having string, params ...interface{}) Selecter
	OrderBy(orderBy string) Selecter
	For(locking string) Selecter
}

Selecter is a SELECT statement builder.

func Select

func Select(col ...string) Selecter

type Updater

type Updater interface {
	Builder
	With(name string, q Builder) Updater
	From(from string, params ...interface{}) Updater
	Set(set string, params ...interface{}) Updater
	Where(where string, params ...interface{}) Updater
	Returning(returning ...string) Updater
}

Updater is an UPDATE statement builder.

func Update

func Update(table string) Updater

type Upserter

type Upserter interface {
	Builder
	With(name string, q Builder) Upserter
	Columns(col ...string) Upserter
	Values(params ...interface{}) Upserter
	From(q Selecter) Upserter
	Update(update string, params ...interface{}) Upserter // unless specified, Columns with EXCLUDED values used
	Returning(returning ...string) Upserter
}

Upserter is an INSERT statement builder.

func Upsert

func Upsert(table, target string, params ...interface{}) Upserter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto