Flop.Cursor (Flop v0.8.1) View Source

Functions for encoding, decoding and extracting cursor values.

Link to this section Summary

Functions

Decodes a cursor value.

Encodes a cursor value.

Takes a map or a struct and the order_by field list and returns the cursor value.

Retrieves the start and end cursors from a query result.

Link to this section Functions

Link to this function

decode(encoded)

View Source (since 0.8.0)

Specs

decode(binary()) :: map()

Decodes a cursor value.

Link to this function

encode(key)

View Source (since 0.8.0)

Specs

encode(map()) :: binary()

Encodes a cursor value.

Link to this function

get_cursor_from_map(item, order_by)

View Source (since 0.8.0)

Specs

get_cursor_from_map(map(), [atom()]) :: map()

Takes a map or a struct and the order_by field list and returns the cursor value.

This function is used as a default if no :get_cursor_value_func option is set.

Link to this function

get_cursors(results, order_by, opts)

View Source (since 0.8.0)

Specs

get_cursors([any()], [atom()], keyword()) :: {binary(), binary()} | {nil, nil}

Retrieves the start and end cursors from a query result.