repo

package
v0.0.0-...-ea214e1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AND = " AND "
View Source
const EQ = "="
View Source
const IN = "IN"
View Source
const InvalidCount = -1

Variables

Functions

func Count

func Count[T TableNameType](conds []KeyValueField) (n int64, err error)

func Delete

func Delete[T TableNameType](conds []KeyValueField) error

func Exists

func Exists[T TableNameType](conds []KeyValueField) (bool, error)

func Find

func Find[T TableNameType](fields []string, conds []KeyValueField) ([]*T, error)

func FindLimit

func FindLimit[T TableNameType](fields []string, conds []KeyValueField, orderBy string, offset int, limit int) ([]*T, error)

limit = 0 means no limit

func FindRow

func FindRow[T TableNameType](fields []string, conds []KeyValueField) (*T, error)

func Insert

func Insert[T TableNameType](attributes []KeyValueField) (*T, error)

func InsertSkipExists

func InsertSkipExists[T TableNameType](attributes []KeyValueField, skipExists bool) (*T, error)

func ItemResp

func ItemResp[M TableNameType, MR ModelResp](m *M) *MR

func ListResp

func ListResp[M TableNameType, MR ModelResp]() ([]*MR, error)

func Setup

func Setup()

func UpdateFields

func UpdateFields[T TableNameType](id int64, fields []KeyValueField) bool

func UpdateRow

func UpdateRow[T TableNameType](id int64, field string, value any) bool

Types

type Attribute

type Attribute struct {
	Key   string
	Value any
}

func NewKV

func NewKV(key string, value any) *Attribute

func (*Attribute) KeyField

func (attr *Attribute) KeyField() string

func (*Attribute) Operator

func (attr *Attribute) Operator() string

func (*Attribute) ValueField

func (attr *Attribute) ValueField() any

type InQuery

type InQuery[T any] struct {
	Field  string
	Values []T
}

func NewIn

func NewIn[T any](field string, values []T) *InQuery[T]

func (*InQuery[T]) KeyField

func (in *InQuery[T]) KeyField() string

func (*InQuery[T]) Operator

func (in *InQuery[T]) Operator() string

func (*InQuery[T]) ValueField

func (in *InQuery[T]) ValueField() any

type KeyValueField

type KeyValueField interface {
	KeyField() string
	ValueField() any
	Operator() string
}

type ModelResp

type ModelResp interface {
	Fields() []string
}

type TableNameType

type TableNameType interface {
	TableName() string
}

Jump to

Keyboard shortcuts

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