query

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(table *builder.Table, data QueryArg) (builder.TDBTableRow, error)

func Delete

func Delete(table *builder.Table, row builder.TDBTableRow)

func Find

func Find(table *builder.Table, where QueryArg, allow_empty_where bool) ([]builder.TDBTableRow, error)

func FindUnique

func FindUnique(table *builder.Table, where QueryArg) (builder.TDBTableRow, error)

Note: returns a nil value when no row is found(does not throw errow). Always make sure to account for this case

func FindWithArgs

func FindWithArgs(table *builder.Table, args FindArgs, allow_empty_where bool) ([]builder.TDBTableRow, error)

func Update

func Update(table *builder.Table, row builder.TDBTableRow, data QueryArg) (builder.TDBTableRow, error)

Types

type FindArgs

type FindArgs struct {
	Where   QueryArg
	Take    int
	OrderBy map[string]OrderBy
	Cursor  QueryArg
}

type OrderBy

type OrderBy string
const (
	OrderByAsc  OrderBy = "asc"
	OrderByDesc OrderBy = "desc"
)

type QueryArg

type QueryArg map[string]any

func (QueryArg) Get

func (q QueryArg) Get(key string) any

func (QueryArg) Has

func (q QueryArg) Has(key string) bool

type QueryError

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

func NewQueryError

func NewQueryError(status int, msg string) *QueryError

func (QueryError) Error

func (e QueryError) Error() string

func (QueryError) Status

func (e QueryError) Status() int

Jump to

Keyboard shortcuts

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