Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/aliereno/go-pagination

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/aliereno/go-pagination

  • v0.1.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

Go Pagination

golang version  go report  go-pagination license

*** This repo is written with learning and experimenting purposes. I am open to suggestions or any kind of help. ***

Installation

go get -u github.com/aliereno/go-pagination

Database integrations:

  • gorm

Framework integrations:

Example

func main() {
	app := fiber.New()

	// paginate simple array
	app.Get("/array", func(c *fiber.Ctx) error {
		return c.JSON(pagination.Paginate(items, pagination.Config{
			Framework: frameworks.Fiber{
				Context: c,
			},
		}))
	})

	// paginate gorm.DB query
	app.Get("/gorm", func(c *fiber.Ctx) error {
		query := gorm.DB.Model(&User{}).Order("id desc")
		return c.JSON(pagination.Paginate(query, pagination.Config{
			Framework: frameworks.Fiber{
				Context: c,
			},
			Datatype: datatype.GORM{},
		}))
	})

	log.Fatal(app.Listen(":3000"))
}

FAQs

Package last updated on 16 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc