Phoenix.Sync.Router (Phoenix.Sync v0.3.0-pre-1)
View SourceProvides router macros to simplify the exposing of Electric shape streams within your Phoenix or Plug application.
Phoenix Integration
When using within a Phoenix application, you should just import the macros defined here
import Elixir.Phoenix.Sync.RouterPlug Integration
Within Plug applications you need to do a little more work.
TODO
Summary
Functions
Defines a synchronization route for streaming Electric shapes.
Functions
Defines a synchronization route for streaming Electric shapes.
The shape can be defined in several ways:
Using Ecto Schemas
Defines a synchronization route for streaming Electric shapes using an Ecto schema.
sync "/all-todos", MyApp.TodoNote: Only Ecto schema modules are supported as direct arguments. For Ecto queries,
use the query option in the third argument or use Phoenix.Sync.Controller.sync_render/3.
Using Ecto Schema and where clause
sync "/incomplete-todos", MyApp.Todo, where: "completed = false"
Using an explicit table
sync "/incomplete-todos", table: "todos", where: "completed = false"Options
:table- (required if no schema provided) The database table to expose:namespace- (optional) The namespace for the table:where- (optional) The where clause to apply to the data:columns- (optional) Subset of table columns to include in the streamed data (default all columns):storage- (optional) Storage configuration:replica- (optional) Replication strategy