Core LibraryunreleasedAPI Reference

Choose documentation 1

latest

Current version

latest
English

Unreleased libtmux_erlang has not been released. Its API may change during development. This site's structure and URLs may change too.

module libtmux-erlang latest

tmux_filter

Construct portable conditions and prepare them against captured values.

Source and package
Qualified name
tmux_filter
Package
libtmux_erlang
Source
apps/libtmux_erlang/src/tmux_filter.erl

Description#

Local criteria use atom keys, binary text and schema-typed values. Fields and operators conjoin. Boolean branches use 'and', 'or' and 'not'; relationships use some/every/none/count or is/is_not. Validation examines the entire input before evaluation. No function here performs tmux I/O. Use portable filters with tmux_select:where/2 or tmux_query:where/2; the query guide explains their different execution boundaries.

Wire version 1 uses generated camelCase field names, snake_case operators, JSON null for known absence and {"base64": "..."} for byte operands. Byte values never become text implicitly. Regex uses the restricted ASCII portable_v1 dialect, absolute anchors and no flags. Preparation compiles each pattern once. Non-ASCII subjects and exhausted match limits return errors.

Both input criteria and their normalized wire document must fit the grammar, depth and byte limits. Resource errors can refer to the canonical wire path.

Examples#

1> Fields = #{id => <<"%1">>, current_command => <<"vim">>}, ok.
ok
2> {ok, P} = tmux_model:pane(Fields), S = tmux_select:from_list(pane, [P]), ok.
ok
3> R = #{pattern => <<"^(vim|nvim)$">>, dialect => portable_v1}, ok.
ok
4> tmux_select:size(tmux_select:where(#{current_command => #{regex => R}}, S)).
1

Members14#

Common operations3#

  • decode_json/1 function Decode bounded external JSON with duplicate-key, trailing-input and depth checks. Returns tagged errors with input paths. Parsing does not execute tmux or choose application modules.
  • new/2 function Validate criteria or reuse an already normalized filter for the same entity.
  • prepare/2 function Bind a filter to one snapshot and check all required coverage first.

Other members11#

  • entity/1 function Return the schema entity this portable filter accepts, without I/O.
  • expr/0 typealias Normalized data expressions with stable field IDs, used by internal planners; not the wire grammar.
  • from_wire/2 function Validate a versioned filter document using generated wire-name allowlists. Rejects unknown fields, operators, wrong entity/version and resource limits. No payload key becomes an atom; this does not execute a query.
  • matches/2 function Evaluate an unmodified captured row against a prepared filter. Returns a Boolean result or tagged context/regex resource error. It performs no tmux I/O and never converts evaluation failure into a nonmatch.
  • new_or_error/2 function Construct a normalized portable filter, raising bad_filter on malformed trusted criteria. Performs no tmux I/O. External input should use new/2 or from_wire/2 for tagged validation errors.
  • predicate/1 function Return a Boolean function bound to the prepared observation context.
  • prepared/0 typealias A cached evaluator bound to one captured observation and schema context.
  • requirements/1 function Derive every field and complete relationship needed for faithful evaluation. The complete requirement set is checked before short-circuiting any row.
  • t/0 typealias Portable normalized predicate data for one schema entity; contains no executable state.
  • to_wire/1 function Export versioned JSON-compatible predicate data with generated wire names. Byte operands use base64 objects and known absence uses JSON null. Functions, compiled regexes and native record internals never enter this representation.
  • wire_document/0 typealias Version-one JSON-compatible filter envelope with binary keys version, entity and where. entity is the generated wire entity name; where contains Boolean, field and relationship conditions. Version is the integer 1. Keys and operators still require from_wire/2 validation; the typespec alone does not authorize arbitrary fields or unbounded external input.

Guides#

Pages that discuss tmux_filter.

Esc

Type to search.

Reference previewOpen reference