requestutil

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: LGPL-2.1 Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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: `+id,-id`
	// 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: `+id,-id`
	// 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

Jump to

Keyboard shortcuts

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