repositorypackage
1.0.4
Repository: https://github.com/asger-noer/go-cursor.git
Documentation: pkg.go.dev
# README
Cursor

Cursor is a generic implementation of the Relay Cursor Connections Specification. It is a simple library that can be used to paginate any list of items.
Installation
Simply run the following command to get the package and start using it:
go get github.com/asger-noer/go-cursor
Usage
You can create a new connection by providing a list of items and a cursor function that can be used to get the cursor for each item. You can also provide a list of arguments to the connection to specify the pagination.
args := []cursor.Argument{
cursor.First(10),
cursor.After("MQ=="),
}
// Create a new connection with the list of users
cur, err := cursor.New(users, userCursor, args...)
if err != nil {
// Handle error
}
// pageinfo contains information about the current page
pageinfo := cur.PageInfo()
// Edges contains the list of items in the current page
edges := cur.Edges() {