Skip to content

Facilitates seamless pagination of PostgreSQL queries. It simplifies the process of fetching paginated data from a database by efficiently incorporating the LIMIT and OFFSET clauses into queries. Developers can easily integrate this library to implement smooth and performant pagination for their.

License

Notifications You must be signed in to change notification settings

booscaaa/go-paginate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Paginate - Go package to generate query pagination

Reference Release Software License Test status Coverage


Why?

This project is part of my personal portfolio, so, I'll be happy if you could provide me any feedback about the project, code, structure or anything that you can report that could make me a better developer!

Email-me: [email protected]

Connect with me at LinkedIn.


Functionalities

  • Generate query and query count pagination for postgresql

Starting

Installation

go get github.com/booscaaa/go-paginate

Usage

// OLD VERSION
import "github.com/booscaaa/go-paginate/paginate"

query, queryCount, err := paginate.
		Paginate("SELECT id, name FROM user").
		Sort([]string{"name", "last_name"}).
		Desc([]string{"true", "false"}).
		Page(1).
		RowsPerPage(50).
		SearchBy("vinicius").
		Query()

if err != nil {
  //handler error
}

// else use the query and queryCount to paginate with pq, pgx or other


// NOW USE THIS
import "github.com/booscaaa/go-paginate/paginate"

pagin := paginate.Instance()
query, queryCount := pagin.
    Query("SELECT t.* FROM test t").
    Sort([]string{"name", "last_name"}).
    Desc([]string{"true", "false"}).
    Page(3).
    RowsPerPage(50).
    SearchBy("vinicius", "t.id").
    Select()

// use the query and queryCount to paginate with pq, pgx or other

Contributing

You can send how many PR's do you want, I'll be glad to analyze and accept them! And if you have any question about the project...

Email-me: [email protected]

Connect with me at LinkedIn

Thank you!

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Facilitates seamless pagination of PostgreSQL queries. It simplifies the process of fetching paginated data from a database by efficiently incorporating the LIMIT and OFFSET clauses into queries. Developers can easily integrate this library to implement smooth and performant pagination for their.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages