builder

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpectedStruct = fmt.Errorf("expected a struct")
)

Functions

func DBTag

func DBTag(f reflect.StructField) []string

func EachField added in v0.14.0

func EachField(v reflect.Value, cb func(sf reflect.StructField, fv reflect.Value) error) error

func FieldName

func FieldName(f reflect.StructField) string

func GetTable

func GetTable(m any) string

func GetTableSingular

func GetTableSingular(m any) string

func GetValue

func GetValue(v any, key string) (any, bool)

func HasField added in v0.11.8

func HasField(v any, field string) bool

func Includes added in v0.14.0

func Includes[T comparable](arr []T, v T) bool

func PrimaryKey

func PrimaryKey(m any) []string

func RGetValue added in v0.11.4

func RGetValue(rv reflect.Value, key string) (any, bool)

Types

type PrimaryKeyer

type PrimaryKeyer interface {
	PrimaryKey() []string
}

type SQLResult

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

func Result

func Result() *SQLResult

func (*SQLResult) Add

func (r *SQLResult) Add(sql string, bindings []any, err error) *SQLResult

func (*SQLResult) AddString

func (r *SQLResult) AddString(sql string) *SQLResult

func (*SQLResult) ToSQL

func (r *SQLResult) ToSQL(d dialects.Dialect) (string, []any, error)

type Tabler

type Tabler interface {
	Table() string
}

type ToSQLFunc added in v0.4.0

type ToSQLFunc func(d dialects.Dialect) (string, []any, error)

func (ToSQLFunc) ToSQL added in v0.4.0

func (f ToSQLFunc) ToSQL(d dialects.Dialect) (string, []any, error)

type ToSQLer

type ToSQLer interface {
	ToSQL(d dialects.Dialect) (string, []any, error)
}

func Concat added in v0.12.0

func Concat(sqlers ...ToSQLer) ToSQLer

func Group

func Group(sqler ToSQLer) ToSQLer

func Identifier

func Identifier(i string) ToSQLer

func IdentifierList

func IdentifierList(strs []string) []ToSQLer

func Join

func Join[T ToSQLer](sqlers []T, sep string) ToSQLer

func Literal

func Literal(v any) ToSQLer

func LiteralList

func LiteralList(values []any) []ToSQLer

func Raw

func Raw(sql string, bindings ...any) ToSQLer

Jump to

Keyboard shortcuts

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