mystiq

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT, MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Offset   = "offset"
	Fulltext = "fulltext"
	Order    = "order"
	Limit    = "limit"
)
View Source
const (
	Asc  = "asc"
	Desc = "desc"
)

Variables

View Source
var (
	DefaultLimit = 20
)
View Source
var (
	ErrorSliceValue = errors.New("value must be a slice")
)

Functions

This section is empty.

Types

type Fields

type Fields struct {
	Fulltext []string
	Order    map[string]string
}

type Mystiq

type Mystiq interface {
	DB(db *quirk.DB, query Query) Mystiq
	Data(data []map[string]any) Mystiq

	GetAllFunc(fn func(param Param, t any) error) Mystiq
	GetOneFunc(fn func(name string, v any, t any) error) Mystiq
	GetManyFunc(fn func(name string, v any, t any) error) Mystiq

	GetAll(param Param, t any) error
	GetOne(name string, v any, t any) error
	GetMany(name string, v any, t any) error

	MustGetAll(param Param, t any)
	MustGetOne(name string, v any, t any)
	MustGetMany(name string, v any, t any)
}

func New

func New() Mystiq

type OrderParam

type OrderParam struct {
	Field     string
	Direction string
}

type Param

type Param struct {
	Fulltext string
	Offset   int
	Limit    int
	Order    []string
	Fields   Fields
}

func (Param) Parse

func (p Param) Parse(c mirage.Ctx) Param

func (Param) Use

func (p Param) Use(q *quirk.Quirk)

type Query

type Query struct {
	Table  string
	Fields map[string]string
	Value  string
	Alias  string
}

func CreateSelect added in v0.1.5

func CreateSelect(table, textColumn string, valueColumn ...string) Query

func (Query) CanUse

func (q Query) CanUse() bool

Jump to

Keyboard shortcuts

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