AshScylla.DataLayer.Pagination (AshScylla v0.1.1)

Copy Markdown View Source

Pagination support for AshScylla using ScyllaDB/Cassandra tokens.

ScyllaDB/Cassandra doesn't support OFFSET natively. Instead, it uses tokens for efficient pagination.

Summary

Functions

Builds a CQL query with token-based pagination.

Fetches a page of results using token-based pagination.

Functions

build_paginated_query(table, filters, token, page_size)

(since 1.0.0)

Builds a CQL query with token-based pagination.

fetch_page(repo, table, filters, token, page_size)

(since 1.0.0)

Fetches a page of results using token-based pagination.

Examples:

# First page
{:ok, {records, next_token}} = DataLayer.Pagination.fetch_page(repo, table, %{}, nil, 10)

# Next page using token
{:ok, {records, next_token}} = DataLayer.Pagination.fetch_page(repo, table, %{}, token, 10)