Skip to content

Instantly share code, notes, and snippets.

@rednafi
Created April 17, 2025 12:47
Show Gist options
  • Save rednafi/8c13b4a446fee7aeb5096413f451d3af to your computer and use it in GitHub Desktop.
Save rednafi/8c13b4a446fee7aeb5096413f451d3af to your computer and use it in GitHub Desktop.
for {
// Build the paginated query
query := session.Query("SELECT id, name FROM users").PageSize(pageSize).PageState(pageState)
iter := query.Iter()
var id gocql.UUID
var name string
for iter.Scan(&id, &name) {
fmt.Printf("User: %s - %s\n", id, name)
}
// Get the next page state
pageState = iter.PageState()
if len(pageState) == 0 {
break // no more pages
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment