Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fourcels/paginate

GORM Paginate
https://github.com/fourcels/paginate

gorm paginate

Last synced: about 11 hours ago
JSON representation

GORM Paginate

Awesome Lists containing this project

README

        

# GORM Paginate

[![GoDevDoc](https://img.shields.io/badge/dev-doc-00ADD8?logo=go)](https://pkg.go.dev/github.com/fourcels/paginate)

## Query Params

```go
type DefaultPagination struct {
Page int `query:"page" minimum:"1" default:"1"`
Size int `query:"size" minimum:"1" default:"10"`
Sort string `query:"sort" description:"1. asc: **id**\n2. desc: **-id**\n3. multi: **id,created_at**"`
Search string `query:"search"`
Filter map[string]string `query:"filter" description:"1. Comparison Operators: **eq**, **ne**, **like**, **contain**, **gt**, **gte**, **lt**, **lte**, **in**\n2. Usage: \"field**[:op]**\":value"`
}
```

## Filter

1. Comparison Operators: `eq`, `ne`, `like`, `contain`, `gt`, `gte`, `lt`,
`lte`, `in`
1. Usage: "field`[:op]`":value

## Sort

1. asc: id
1. desc: -id
1. multi: id,created_at

## Example

[exmaples](./examples/main.go)