Skip to content

Leukocyte-Lab/gorm-paginator

Repository files navigation

gorm-paginator

Usage

go get github.com/Leukocyte-Lab/gorm-paginator
pgntr := paginator.New(page, orders, map[string]string{})

var models []*Model
result := pgntr.GenGormTransaction(dao.DB).Find(&models)
if result.Error != nil {
    // TODO: handle error
}

err := pgntr.CountPageTotal(result)
if result.Error != nil {
    // TODO: handle error
}

// return models, pgntr.Page

License

MIT