Selectors

Introduction

Selectors are SQL-like clauses that specify which records an accessor or mutator should act on. Each accessor/mutator is associated with exactly one selector. The selector is specified at accessor/mutator creation time, either as a free text input in the UI, or as a string through the API.

The following are examples of selectors:

  • {Email} = ?
  • {ID} = ANY(?) OR {Email} LIKE ?
  • {DateCreated} < ? AND {DateCreated} >= ?

Each ? represents a parameter that is passed in an array, called SelectorValues, at access or mutator invocation time. This parameter can be a single value, or an array of possible values. This allows you to specify (for example) an email or a set of user IDs to match on. At invocation time, the values of the SelectorValues array are passed in and replace the ?s in sequential order.

Example

One allowable selector clause is {ID} = ANY(?) OR {Email} = ?. This might receive an array, SelectorValues, like [[1, 2, 3], “[email protected]”]. In this case, the accessor would return any records such that: the ID is 1, 2 or 3 or email is "[email protected]".

Generalization

More generally, selector clauses take one of these two forms:

  • {column_name} operator ?
  • {column name} = ANY(?)

And selectors are an AND / OR combination of selector clauses:

{column_name} operator ?  
[conjunction] {column_name} = ANY(?)  
[conjunction] {column_name} operator ?  
...

Allowed Terms

Conjunctions:

AND / OR

Operators:

= | < | > | <= | >= | != | = ANY() | LIKE | ILIKE

If you need operators in addition to the ones above, please reach out to [email protected].