All Projects → hellokaton → gorm-paginator

hellokaton / gorm-paginator

Licence: MIT license
gorm pagination extension

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to gorm-paginator

go-paginate
Cursor-based go paginator
Stars: ✭ 48 (-68.83%)
Mutual labels:  pagination, gorm
gorm-cursor-paginator
A paginator doing cursor-based pagination based on GORM
Stars: ✭ 92 (-40.26%)
Mutual labels:  pagination, gorm
Gorm Paginator
gorm pagination extension
Stars: ✭ 136 (-11.69%)
Mutual labels:  pagination, gorm
Tablefilter
A Javascript library making HTML tables filterable and a bit more :)
Stars: ✭ 248 (+61.04%)
Mutual labels:  pagination
flask-rest-paginate
Pagination Extension for flask-restful
Stars: ✭ 18 (-88.31%)
Mutual labels:  pagination
materialui-pagination
A simple pagination component for Material UI.
Stars: ✭ 31 (-79.87%)
Mutual labels:  pagination
continuation-token
A library for fast, reliable and stateless Web API pagination with Continuation Tokens.
Stars: ✭ 17 (-88.96%)
Mutual labels:  pagination
Gatsby Starter Business
Gatsby Business Website Starter
Stars: ✭ 243 (+57.79%)
Mutual labels:  pagination
repository
[PHP 7] Implementation and definition of a base Repository in Domain land.
Stars: ✭ 26 (-83.12%)
Mutual labels:  pagination
go-pangu
rest api web server based on go(High availability, high security, high performance)
Stars: ✭ 45 (-70.78%)
Mutual labels:  gorm
opentracing-gorm
OpenTracing instrumentation for GORM.
Stars: ✭ 46 (-70.13%)
Mutual labels:  gorm
BEW-2.5-Strongly-Typed-Languages
💪 Learn and implement the design patterns and best practices that make Go a top choice at high-velocity startups like Lyft, Heroku, Docker, Medium, and more!
Stars: ✭ 14 (-90.91%)
Mutual labels:  gorm
beer-app
🍺 Example App - Paginate API response with BLoC in Flutter
Stars: ✭ 20 (-87.01%)
Mutual labels:  pagination
golang-example-app
Example application
Stars: ✭ 138 (-10.39%)
Mutual labels:  gorm
go-orm-code-helper
🔥🔥🔥go-orm-code-helper is a goland plugin, it aims to make gorm code getting more simple
Stars: ✭ 22 (-85.71%)
Mutual labels:  gorm
Instagram Proxy Api
CORS compliant API to access Instagram's public data
Stars: ✭ 245 (+59.09%)
Mutual labels:  pagination
simple-mpesa
A simple example of how MPESA works. Works with all 3 types of customers i.e. Agents, Merchants and Subscribers. Allows you to configure a tariff and apply it to transactions. The project follows DDD principles.
Stars: ✭ 31 (-79.87%)
Mutual labels:  gorm
blogging-app-with-Angular-CloudFirestore
A blogging application created with the help of Angular on front-end and Google Cloud Firestore on backend.
Stars: ✭ 45 (-70.78%)
Mutual labels:  pagination
Ajaxinate
🎡 Ajax pagination plugin for Shopify themes
Stars: ✭ 107 (-30.52%)
Mutual labels:  pagination
gorm-mongodb
GORM for MongoDB
Stars: ✭ 58 (-62.34%)
Mutual labels:  gorm

gorm-paginator

Usage

go get github.com/biezhi/gorm-paginator/pagination
type User struct {
	ID       int
	UserName string `gorm:"not null;size:100;unique"`
}

var users []User
db = db.Where("id > ?", 0)

pagination.Pagging(&pagination.Param{
    DB:      db,
    Page:    1,
    Limit:   3,
    OrderBy: []string{"id desc"},
}, &users)

With Gin

r := gin.Default()
r.GET("/", func(c *gin.Context) {
    page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
    limit, _ := strconv.Atoi(c.DefaultQuery("limit", "3"))
    var users []User

    paginator := pagination.Pagging(&pagination.Param{
        DB:      db,
        Page:    page,
        Limit:   limit,
        OrderBy: []string{"id desc"},
        ShowSQL: true,
    }, &users)
    c.JSON(200, paginator)
})

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].