Package tech.ydb.yoj.repository.ydb.yql
Class YqlPredicate
java.lang.Object
tech.ydb.yoj.repository.ydb.yql.YqlPredicate
- All Implemented Interfaces:
YqlStatementPart<YqlPredicate>
Represents a predicate: a boolean expression that can appear in the
WHERE YQL clause.
To return valid YQL template for the predicate, including references to statement parameters (as ?)
and entity fields (as {field.subfield}), call toYql().
To construct simple predicates, use static methods of this class, e.g.,
in() and eq(String, Object).
To invert your predicate, call negate() (instance method) or
not(pred) (static method).
To combine predicates, use the and() and
or() (both static and instance methods are available).
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic YqlPredicatestatic YqlPredicatestatic YqlPredicateand(@NonNull Collection<YqlPredicate> predicates) and(@NonNull YqlPredicate other) static YqlPredicateand(@NonNull YqlPredicate first, @NonNull YqlPredicate... rest) final List<? extends YqlStatementPart<?>>combine(@NonNull List<? extends YqlPredicate> others) static <T> YqlPredicatefinal intfinal StringgetType()final Stringstatic <T> YqlPredicatestatic <T> YqlPredicatestatic <T> YqlPredicatein(@NonNull String fieldPath, @NonNull Collection<@NonNull ? extends T> values) static <T> YqlPredicatestatic YqlPredicatestatic YqlPredicatestatic <T> YqlPredicatestatic <T> YqlPredicatenegate()static <T> YqlPredicatestatic YqlPredicatenot(@NonNull YqlPredicate pred) static YqlPredicatestatic YqlPredicatestatic YqlPredicateor(@NonNull Collection<YqlPredicate> predicates) or(@NonNull YqlPredicate other) static YqlPredicateor(@NonNull YqlPredicate first, @NonNull YqlPredicate... rest) paramAt(int index) static voidsetUseLegacyIn(boolean useLegacyIn) static voidsetUseLegacyRel(boolean useLegacyRel) abstract <T extends tech.ydb.yoj.repository.db.Entity<T>>
StringtoYql(@NonNull tech.ydb.yoj.repository.db.EntitySchema<T> schema) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tech.ydb.yoj.repository.ydb.yql.YqlStatementPart
toFullYql
-
Field Details
-
TYPE
- See Also:
-
-
Constructor Details
-
YqlPredicate
public YqlPredicate()
-
-
Method Details
-
setUseLegacyIn
public static void setUseLegacyIn(boolean useLegacyIn) -
setUseLegacyRel
public static void setUseLegacyRel(boolean useLegacyRel) -
where
-
not
-
and
public static YqlPredicate and(@NonNull @NonNull YqlPredicate first, @NonNull @NonNull YqlPredicate... rest) -
and
-
or
public static YqlPredicate or(@NonNull @NonNull YqlPredicate first, @NonNull @NonNull YqlPredicate... rest) -
or
-
in
@SafeVarargs public static <T> YqlPredicate in(@NonNull @NonNull String fieldPath, @NonNull T possibleValue, @NonNull @NonNull T... restOfPossibleValues) -
in
public static <T> YqlPredicate in(@NonNull @NonNull String fieldPath, @NonNull @NonNull Collection<@NonNull ? extends T> values) -
eq
-
neq
-
lt
-
lte
-
gt
-
gte
-
like
-
like
public static YqlPredicate like(@NonNull @NonNull String fieldPath, @NonNull @NonNull String value, @Nullable Character escape) -
notLike
public static YqlPredicate notLike(@NonNull @NonNull String fieldPath, @NonNull @NonNull String value) -
notLike
public static YqlPredicate notLike(@NonNull @NonNull String fieldPath, @NonNull @NonNull String value, @Nullable Character escape) -
alwaysTrue
-
alwaysFalse
-
toYql
public abstract <T extends tech.ydb.yoj.repository.db.Entity<T>> String toYql(@NonNull @NonNull tech.ydb.yoj.repository.db.EntitySchema<T> schema) - Specified by:
toYqlin interfaceYqlStatementPart<YqlPredicate>- Parameters:
schema- entity schema- Returns:
- non-null, valid YQL for the predicate, possibly including reference to some positional statement
parameters as
?and entity field references as{field.path}
-
getType
- Specified by:
getTypein interfaceYqlStatementPart<YqlPredicate>
-
getYqlPrefix
- Specified by:
getYqlPrefixin interfaceYqlStatementPart<YqlPredicate>
-
getPriority
public final int getPriority()- Specified by:
getPriorityin interfaceYqlStatementPart<YqlPredicate>
-
combine
public final List<? extends YqlStatementPart<?>> combine(@NonNull @NonNull List<? extends YqlPredicate> others) - Specified by:
combinein interfaceYqlStatementPart<YqlPredicate>
-
paramStream
- Returns:
- stream of statement parameter specifications, if this YQL predicate uses parameters
-
paramAt
-
paramList
- Returns:
- list of statement parameter specification, in the same order as
paramStream()
-
negate
-
and
-
or
-
and
-
or
-