Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListCondition ¶
type ListCondition[T any] struct { // Current page number, starts from 1 Page int // Number of records per page PerPage int // Field names for sorting, separated by comma. // The direction is specified by `+` (ASC) and `-` (DESC) prefix, eg: `+name,-age` // WARNING: SQL Injection vulnerability! User input must be validated before sending to database Sort string // Whether to count the total records. If not, the returning `count` number will always be zero. Count bool // Custom filter type Filter T }
ListCondition represents a generic type for listing and filtering data
type ListQueryCondition ¶
type ListQueryCondition ListCondition[[]any]
ListQueryCondition represents a generic type for listing and filtering data
type ListQueryRequest ¶
type ListQueryRequest struct { // Current page number, starts from 1 // in: query // default: 1 Page int `json:"p" query:"p"` // Number of records per page // in: query // default: 25 PerPage int `json:"pp" query:"pp"` // Field names for sorting, separated by comma. // The direction is specified by `+` (ASC) and `-` (DESC) prefix, eg: `+name,-age` // in: query Sort string `json:"s" query:"s"` }
ListQueryRequest contains basic information to do sorting and paging for a listing api WARNING: SQL Injection vulnerability! Sort param must be validated before sending to database swagger:model
func (*ListQueryRequest) ToListQueryCond ¶
func (l *ListQueryRequest) ToListQueryCond(filter []any) *ListQueryCondition
ToListQueryCond transforms the service request to list query conditions
Click to show internal directories.
Click to hide internal directories.