Spear.Filter.sigil_f

You're seeing just the function sigil_f, go back to Spear.Filter module for more information.
Link to this function

sigil_f(source, mods)

View Source (since 0.1.0)

Specs

sigil_f(binary(), charlist()) :: t()

A sigil defining short-hand notation for writing filters

Filters may either filter on EventStoreDB stream name or event type and may either filter by a regular expression or a list of prefix strings.

Modifiers

This f sigil supports the following modifiers. (Note that modifiers are the suffix of the sigil. E.g. the i in ~r/hello/i is a modifier for the regex sigil that declares that the match is case-insensitive.)

For the choice between stream-name and event-type filtering:

  • s - filter on the stream name
  • t - filter on the event type

For the choice between prefixes and regular expressions:

  • p - filter by a list of prefixes. If this option is passed the sigil body will be interpreted as a white-space separated list of prefixes similar to sigil_w/2 from the standard library
  • r - filter using a regular expression

Examples

iex> import Spear.Filter
iex> ~f/My.Aggregate.A- My.Aggregate.B-/ps
%Spear.Filter{
  by: ["My.Aggregate.A-", "My.Aggregate.B-"],
  checkpoint_after: 1024,
  on: :stream_name
}
iex> ~f/^[^\$].*/rs
%Spear.Filter{by: ~r/^[^\$].*/, checkpoint_after: 1024, on: :stream_name}