Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fourcels/paginate
GORM Paginate
https://github.com/fourcels/paginate
gorm paginate
Last synced: about 11 hours ago
JSON representation
GORM Paginate
- Host: GitHub
- URL: https://github.com/fourcels/paginate
- Owner: fourcels
- License: mit
- Created: 2023-05-22T09:29:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-14T08:20:52.000Z (2 months ago)
- Last Synced: 2024-09-14T19:26:48.894Z (2 months ago)
- Topics: gorm, paginate
- Language: Go
- Homepage:
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)