filters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedField

type AllowedField struct {
	Name       string
	Column     string
	Type       FieldType
	Searchable bool
	Sortable   bool
	Filterable bool
}

type FieldType

type FieldType string
const (
	TypeString   FieldType = "string"
	TypeNumber   FieldType = "number"
	TypeBoolean  FieldType = "boolean"
	TypeEnum     FieldType = "enum"
	TypeDate     FieldType = "date"
	TypeDateTime FieldType = "datetime"
	TypeJSONB    FieldType = "jsonb"
	TypeRelation FieldType = "relation"
)

type Filter

type Filter struct {
	Field    string `json:"field"`
	Operator string `json:"operator"`
	Value    string `json:"value"`
}

type Query

type Query struct {
	Page    pagination.Page `json:"page"`
	Search  string          `json:"search,omitempty"`
	Sorts   []Sort          `json:"sorts,omitempty"`
	Filters []Filter        `json:"filters,omitempty"`
}

func Parse

func Parse(values url.Values, allowed map[string]AllowedField) (Query, error)

type Sort

type Sort struct {
	Field string `json:"field"`
	Desc  bool   `json:"desc"`
}

Jump to

Keyboard shortcuts

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