Documentation
¶
Index ¶
- func ChainMiddleware(handler http.Handler, middlewares ...Middleware) http.Handler
- func ListMiddleware[T ListParamParser](next http.Handler) http.Handler
- func ParseId(val string) (string, error)
- func ParseLimit(val string) (int, error)
- func ParsePage(val string) (int, error)
- func ParseSortBy(val string, listParamParser ListParamParser) (string, error)
- func ParseValue(val string, sortBy string, listParamParser ListParamParser) (interface{}, error)
- type GetDefaultSortByFunc
- type GetSupportedSortBys
- type ListParamParser
- type ListParams
- type Middleware
- type SortOrder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainMiddleware ¶
func ChainMiddleware(handler http.Handler, middlewares ...Middleware) http.Handler
ChainMiddleware a top-level middleware which applies the given middlewares in order from inner to outer (order of execution)
func ListMiddleware ¶
func ListMiddleware[T ListParamParser](next http.Handler) http.Handler
func ParseLimit ¶
func ParseSortBy ¶
func ParseSortBy(val string, listParamParser ListParamParser) (string, error)
func ParseValue ¶
func ParseValue(val string, sortBy string, listParamParser ListParamParser) (interface{}, error)
Types ¶
type GetDefaultSortByFunc ¶
type GetDefaultSortByFunc func() string
type GetSupportedSortBys ¶
type GetSupportedSortBys func() []string
type ListParamParser ¶
type ListParams ¶
type ListParams struct {
Page int
Limit int
Query string
SortBy string
SortOrder SortOrder
AfterId string
BeforeId string
AfterValue interface{}
BeforeValue interface{}
}
func GetListParamsFromContext ¶
func GetListParamsFromContext(context context.Context) ListParams
func (ListParams) UseCursorPagination ¶
func (lp ListParams) UseCursorPagination() bool
type Middleware ¶
Middleware defines the type of all middleware
Click to show internal directories.
Click to hide internal directories.