View Source API Reference LiveQuery v0.3.1

Modules

LiveQuery allows you to declare how to load, invalidate, and reload your data independently from your consumer logic. An example is going to help a lot here.

Sent in response to a LiveQuery.Protocol.RegisterCallback call. The callback's return value is discarded by the query. The cb_key is used to identify the callback when unregistering it. It is namespaced to the client_pid. That is, different clients can register callbacks with the same cb_key at the same time and they will not interfere with each other.

Sent in response to a LiveQuery.Protocol.UnegisterCallback call. Additionally, a list of these are returned in response to a LiveQuery.Protocol.UnegisterAllCallbacks call. The cb_key is the same one used to identify the callback when registering it.

Returned in response to a LiveQuery.Protocol.Read call (when the query exists).

Given to a callback when the data for a query changes.

Link a client process to a query. Once linked to a query, the client will be monitored, and the query will be guaranteed to exist so long as the client is alive and has manually unlinked from the query.

Returned in response to a LiveQuery.Protocol.Link call.

Returned whenever a operation is attepted against a query that doesn't exist. The only exception is LiveQuery.Protocol.Link and LiveQuery.Protocol.Unlink.

Read the value of a query (the query's init function will be called if it hasn't been called yet). The selector function will be called with the query's value and before the result is returned.

This module defines the LiveQuery.Query.Def behaviour and struct. The behaviour can be used to make a module-base query definition. The struct can be used as a query definition itself.

A query definition defines how to load and maintain a query. It's the blueprint of a query. Anything that implements the LiveQuery.Query.DefLike protocol can be used as a query definition.