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.
- Generate query and query count pagination for postgresql
go get github.com/booscaaa/go-paginate
// 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
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!
This project is licensed under the MIT License - see the LICENSE.md file for details