query

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MySQL driver = iota
	Postgres
)
View Source
const (
	PascalCase casing = iota // Represented as PascalCase
	CamelCase                // Represented as camelCase
	SnakeCase                // Represented as snake_case
)
View Source
const (
	OffsetPagination paginationType = iota
	CursorPagination
)

Variables

This section is empty.

Functions

func NewParam added in v1.2.0

func NewParam(column, value string) param

Types

type Dialect

type Dialect struct {

	// Exported fields
	Driver             driver
	HasAutoIncrementID bool
	APICasing          casing
	DBCasing           casing
	PaginationType     paginationType
	MaxLimit           int
	// contains filtered or unexported fields
}

func (*Dialect) Apply added in v1.2.0

func (d *Dialect) Apply(q *Query)

func (*Dialect) NewQuery added in v1.2.0

func (d *Dialect) NewQuery(mods ...queryMod) *Query

func (*Dialect) ParseFilter added in v1.2.0

func (d *Dialect) ParseFilter(raw string, validateFunc ValidatorFunc) *filter

func (*Dialect) ParsePagination added in v1.2.0

func (d *Dialect) ParsePagination(raw string) queryMod

func (*Dialect) ParseParams added in v1.2.0

func (d *Dialect) ParseParams(raw ...param) *params

func (*Dialect) ParseRelation added in v1.2.0

func (d *Dialect) ParseRelation(raw string) *relation

func (*Dialect) ParseSort added in v1.2.0

func (d *Dialect) ParseSort(raw string, validateFunc ValidatorFunc) *sort

type PaginationResponse

type PaginationResponse = map[string]any

func Paginate added in v1.1.1

func Paginate[T any](q *Query, data []*T) ([]*T, *PaginationResponse)

type ParamSlice added in v1.2.0

type ParamSlice []param

type Query

type Query struct {
	Filter           *filter
	Params           *params
	Sort             *sort
	Relation         *relation
	OffsetPagination *offsetPagination
	// contains filtered or unexported fields
}

func (*Query) Mods

func (q *Query) Mods(tn string) []qm.QueryMod

func (*Query) SQL

func (q *Query) SQL(tn string) (string, []any)

type ValidatorFunc added in v1.2.0

type ValidatorFunc func(k string) bool

Jump to

Keyboard shortcuts

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