SmeeOrgs.Filter (SmeeOrgs v0.2.0)

Copy Markdown View Source

A collection of simple filters to select organizations by various criteria

These are similar to filters in other Smee packages. You should use the Smee.Filter module to filter at the Entity level, as these will only filter Organizations.

Summary

Functions

Filters a stream of organizations to include or exclude those that have the specified text.

Filters a stream of organizations to include or exclude those that have the specified country.

Filters a stream of organizations to include or exclude those that have the specified domain.

Filters a stream of organizations to include or exclude those that have the specified language.

Filters a stream of organizations to include or exclude those that have the specified ID (or IDs).

Filters a stream of organizations to include or exclude those that have the specified tag.

Filters a stream of organizations to include or exclude those that have the specified type.

Functions

contains(enum, text, bool \\ true)

@spec contains(enum :: Enumerable.t(), text :: binary(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of organizations to include or exclude those that have the specified text.

Text can be anywhere in the organisation struct.

The filter is positive by default but can be inverted by specifying false

country(enum, country, bool \\ true)

@spec country(enum :: Enumerable.t(), country :: binary() | atom(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of organizations to include or exclude those that have the specified country.

Countries are specified using ISO Alpha-2 letter codes. Be aware of unusual country codes that do not match the country codes used in domain names, such as the UK which will be "GB".

The filter is positive by default but can be inverted by specifying false

domain(enum, domain, bool \\ true)

@spec domain(enum :: Enumerable.t(), domain :: binary(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of organizations to include or exclude those that have the specified domain.

The filter is positive by default but can be inverted by specifying false

lang(enum, lang, bool \\ true)

@spec lang(enum :: Enumerable.t(), lang :: binary(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of organizations to include or exclude those that have the specified language.

Specify the language as a two character ISO code. Unknown countries can be specified with "ZZ"

The filter is positive by default but can be inverted by specifying false

noid(enum, noids, bool \\ true)

@spec noid(enum :: Enumerable.t(), noids :: binary() | [binary()], bool :: boolean()) ::
  Enumerable.t()

Filters a stream of organizations to include or exclude those that have the specified ID (or IDs).

This function will accept a single ID as a string, or a list of strings.

The filter is positive by default but can be inverted by specifying false

tag(enum, tag, bool \\ true)

@spec tag(enum :: Enumerable.t(), tag :: binary() | atom(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of organizations to include or exclude those that have the specified tag.

It's best to provide the tag as a string.

The filter is positive by default but can be inverted by specifying false

type(enum, type, bool \\ true)

@spec type(enum :: Enumerable.t(), type :: binary() | atom(), bool :: boolean()) ::
  Enumerable.t()

Filters a stream of organizations to include or exclude those that have the specified type.

The filter is positive by default but can be inverted by specifying false