Documentation ¶
Index ¶
- Variables
- func Create(t reflect.Type) reflect.Value
- func CreateFor[T any]() reflect.Value
- func Each(v any, cb func(v reflect.Value, pointer bool) error) error
- func EachField(v reflect.Value, cb func(sf reflect.StructField, fv reflect.Value) error) error
- func FieldName(f reflect.StructField) string
- func GetFields(t reflect.Type) []reflect.StructField
- func GetValue(v any, key string) (any, bool)
- func HasField(v any, field string) bool
- func Includes[T comparable](arr []T, v T) bool
- func NewOf[T any]() (T, error)
- func PrimaryKey(m any) []string
- func PrimaryKeyFields(m any) []reflect.StructField
- func PrimaryKeyValue(m any) ([]any, error)
- func RGetValue(v reflect.Value, key string) (reflect.Value, error)
- func RNewOf(t reflect.Type) (reflect.Value, error)
- func RPrimaryKeyFields(t reflect.Type) []reflect.StructField
- func Zero[T any]() T
- type PrimaryKeyer
- type SQLResult
- type SQLStringFunc
- type SQLStringer
- func Concat(sqlers ...SQLStringer) SQLStringer
- func Group(sqler SQLStringer) SQLStringer
- func Identifier(i string) SQLStringer
- func IdentifierList(strs []string) []SQLStringer
- func Join[T SQLStringer](sqlers []T, sep string) SQLStringer
- func Literal(v any) SQLStringer
- func LiteralList(values []any) []SQLStringer
- func Raw(sql string, bindings ...any) SQLStringer
- type Tag
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrExpectedStruct = fmt.Errorf("expected a struct")
)
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func FieldName ¶
func FieldName(f reflect.StructField) string
func Includes ¶
func Includes[T comparable](arr []T, v T) bool
func PrimaryKey ¶
func PrimaryKeyFields ¶ added in v0.13.1
func PrimaryKeyFields(m any) []reflect.StructField
func PrimaryKeyValue ¶ added in v0.8.0
func RPrimaryKeyFields ¶ added in v0.13.1
func RPrimaryKeyFields(t reflect.Type) []reflect.StructField
Types ¶
type PrimaryKeyer ¶
type PrimaryKeyer interface {
PrimaryKey() []string
}
type SQLResult ¶
type SQLResult struct {
// contains filtered or unexported fields
}
func (*SQLResult) Add ¶
func (r *SQLResult) Add(sqler SQLStringer) *SQLResult
type SQLStringFunc ¶ added in v0.10.0
type SQLStringer ¶ added in v0.10.0
func Concat ¶
func Concat(sqlers ...SQLStringer) SQLStringer
func Group ¶
func Group(sqler SQLStringer) SQLStringer
func Identifier ¶
func Identifier(i string) SQLStringer
func IdentifierList ¶
func IdentifierList(strs []string) []SQLStringer
func Join ¶
func Join[T SQLStringer](sqlers []T, sep string) SQLStringer
func Literal ¶
func Literal(v any) SQLStringer
func LiteralList ¶
func LiteralList(values []any) []SQLStringer
func Raw ¶
func Raw(sql string, bindings ...any) SQLStringer
Click to show internal directories.
Click to hide internal directories.