Cizen v0.12.3 Cizen.Filter View Source

Creates a filter.

Basic

Filter.new(
  fn %Event{body: %SomeEvent{field: value}} ->
    value == :a
  end
)

Matches specific struct

Filter.new(
  fn %Event{body: %SomeEvent{}} -> true end
)

Uses other filter

Filter.new(
  fn %Event{body: %SomeEvent{field: value}} ->
    Filter.match?(other_filter, value)
  end
)

Link to this section Summary

Functions

Joins the given filters with and

Joins the given filters with or

Checks whether the given struct matches or not

Creates a filter with the given anonymous function

Link to this section Types

Link to this type t() View Source
t() :: %Cizen.Filter{code: term()}

Link to this section Functions

Link to this function all(filters) View Source
all([t()]) :: t()

Joins the given filters with and.

Link to this function any(filters) View Source
any([t()]) :: t()

Joins the given filters with or.

Link to this function match?(filter, struct) View Source
match?(t(), term()) :: boolean()

Checks whether the given struct matches or not.

Creates a filter with the given anonymous function.