package
Version:
v0.0.0-...-31c0fd8
Opens a new window with list of versions in this module.
Published: Feb 16, 2024
License: MIT
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
An example implementation of using a continuation token for API paging
Inspired by:
To run...
# one session
docker-compose up
# another
go test
Possible improvements:
- create a client/server with headers to indicate continuation token
- play around with isolation levels in postgres transactions to expose possible phantom or nonrepeatable read
Documentation
¶
type Foo struct {
ID int `db:"id" json:"id"`
Data string `db:"data" json:"data"`
CreatedAt time.Time `db:"created_at" json:"createdAt"`
UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
}
Foo is the best data type
type FooPlusToken struct {
Foo []Foo `json:"foo"`
LastToken string `json:"lastToken"`
NewToken string `json:"newToken"`
}
FooPlusToken is for serializing Foo and the token
Token is a simple struct for the db and default limit
NewToken creates a Token instance
Source Files
¶
Click to show internal directories.
Click to hide internal directories.