KeyConditionRegExp<O> class

A regular expression condition: key =~ /pattern/flags (matches) or key !~ /pattern/flags (does not match).

The pattern is a String or a ConditionParameter (/?/, /?#1/, /?:name/), whose value is a String or a RegExp (only its RegExp.pattern and RegExp.isCaseSensitive are used).

The only flag is i (caseInsensitive). The matching is the same in every adapter (PostgreSQL's semantics):

  • The pattern matches anywhere in the value (use ^...$ for all of it).
  • . also matches a line terminator.
  • ^ and $ match only at the start and end of the whole value.

A value that is not a String is matched by its text (an Enum by its name). A null value matches !~ and not =~ (as != and !~ [...]). A list value (e.g. of a relationship) matches =~ if any element matches, and !~ if any element does not match (as a SQL join of its rows).

Inheritance

Constructors

KeyConditionRegExp(List<ConditionKey> keys, Object pattern, {bool caseInsensitive = false, bool not = false})
Creates a regular expression condition. pattern can be a String, a RegExp (a case-insensitive one sets caseInsensitive) or a ConditionParameter.

Properties

caseInsensitive → bool
The i flag.
final
encodeKey → String
no setterinherited
encodeValue → String
A regexp is encoded as /pattern/flags, not as a JSON value.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
isIDCondition → bool
no setterinherited
isInner → bool
A negated operator needs an outer join: a missing related entity is a null field, which it matches.
no setterinherited
isNegated → bool
If true this is a negated operator (!=, !~), that also matches a null field.
no setteroverride
isWordKey → bool
no setterinherited
keys ↔ List<ConditionKey>
getter/setter pairinherited
not → bool
If true, the condition is !~ (does not match).
final
parameters → List<ConditionParameter>
no setterinherited
parent → Condition?
no setterinherited
pattern → String?
The pattern, if not a ConditionParameter.
no setter
patternParameter → ConditionParameter?
The pattern's ConditionParameter, if any.
no setter
resolved → bool
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
value ↔ Object
getter/setter pairinherited

Methods

cast<T>() → KeyConditionRegExp<T>
override
encode() → String
override
equalsConditionValue(Object? value1, Object? value2, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, TypeInfo? keyType, EntityHandler? keyEntityHandler}) → bool
inherited
getEntityKeyValue(O o, [EntityHandler<O>? entityHandler]) → Object?
inherited
getEntityMapKeyValue(Map<String, dynamic>? entityMap, [EntityHandler<O>? entityHandler]) → KeyConditionValue?
inherited
getField(O o, String key, {EntityHandler<O>? entityHandler}) → dynamic
inherited
getID(O o, {EntityHandler<O>? entityHandler}) → dynamic
inherited
greaterThanConditionValue(Object? value1, Object? value2, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, TypeInfo? keyType, EntityHandler? keyEntityHandler}) → bool
If value1 > value2 (see _orderingConditionValue).
inherited
greaterThanOrEqualConditionValue(Object? value1, Object? value2, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, TypeInfo? keyType, EntityHandler? keyEntityHandler}) → bool
If value1 >= value2 (see _orderingConditionValue).
inherited
hasToManyInKeyPath(EntityHandler? entityHandler) → bool
If any key of the keys path, not only the last one, is a to-many relationship (a field declared as a list of entities or references): roles (the last key), roles.type and owner.roles.type (a key before the last). Then the key's value is a list, one value per related entity.
inherited
inConditionValues(Object? value1, List value2, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, EntityHandler? entityHandler}) → bool
inherited
isRelationshipKey(EntityHandler? entityHandler) → bool
If the keys are a single relationship field of entityHandler's entity: a to-one (an entity, User? owner, or an EntityReference) or a to-many (a List of entities or an EntityReferenceList). Not a path through one (owner.email), nor a field of another type.
inherited
lessThanConditionValue(Object? value1, Object? value2, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, TypeInfo? keyType, EntityHandler? keyEntityHandler}) → bool
If value1 < value2 (see _orderingConditionValue).
inherited
lessThanOrEqualConditionValue(Object? value1, Object? value2, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, TypeInfo? keyType, EntityHandler? keyEntityHandler}) → bool
If value1 <= value2 (see _orderingConditionValue).
inherited
matchesEntity(O o, {EntityHandler<O>? entityHandler, Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters}) → bool
override
matchesEntityMap(Map<String, dynamic> o, {EntityHandler<O>? entityHandler, Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters}) → bool
override
matchesValue(Object? keyValue, RegExp regExp, {EntityHandler? entityHandler}) → bool
Matches a keyValue with regExp (see the class documentation). An entity (or reference) is matched by its ID.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve({Condition? parent, required List<ConditionParameter> parameters}) → void
inherited
resolvePattern({Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, Map<String, Object?>? encodingParameters}) → (String, bool)
Resolves the pattern of this condition and its i flag, with the value of its ConditionParameter, if any.
setField(O o, String key, Object? value, {EntityHandler<O>? entityHandler, EntityCache? entityCache}) → void
inherited
setID(O o, Object id, {EntityHandler<O>? entityHandler}) → void
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

encodePatternLiteral(String pattern) → String
Encodes pattern as a regexp literal's body: / escaped as \/.
resolvePatternValue(Object? value, {bool caseInsensitive = false}) → (String, bool)
Resolves a pattern parameter's value (String or RegExp) and its i flag (from caseInsensitive or a case-insensitive RegExp).
toDartRegExp(String pattern, {bool caseInsensitive = false}) → RegExp
The Dart RegExp with the semantics of a KeyConditionRegExp: . matches a line terminator (dotAll) and ^/$ only the start/end of the whole input (not multiLine). It's unicode (by code point) if the pattern is valid in that stricter mode (e.g. not with \-). Cached.
valueToText(Object value) → String
The text of a value to match: an Enum by its name, otherwise by its Object.toString.