Static
createThe model definition to create a predicate for.
The model instance to extract value equalities from.
Static
createAccepts a GraphQL style filter predicate tree and transforms it into a predicate that storage adapters understand. Example input:
{
and: [
{ name: { eq: "Bob Jones" } },
{ age: { between: [32, 64] } },
{ not: {
or: [
{ favoriteFood: { eq: 'pizza' } },
{ favoriteFood: { eq: 'tacos' } },
]
}}
]
}
The model that the AST/predicate must be compatible with.
The graphQL style AST that should specify conditions for modelDefinition
.
Static
createSearches a Model
table for records matching the given equalities object.
This only matches against fields given in the equalities object. No other fields are tested by the predicate.
The model we need a predicate for.
An object holding field equalities to search for.
Static
getLooks for the storage predicate AST that corresponds to a given storage predicate key.
The key must have been created internally by a DataStore utility
method, such as ModelPredicate.createFromAST()
.
The predicate reference to look up.
Optional
throwOnInvalid: booleanWhether to throw an exception if the predicate isn't a valid DataStore predicate.
Static
isDetermines whether the given storage predicate (lookup key) is a predicate key that DataStore recognizes.
The storage predicate (lookup key) to test.
Static
transformAccepts a GraphQL style filter predicate tree and transforms it into an AST that can be used for a storage adapter predicate. Example input:
{
and: [
{ name: { eq: "Bob Jones" } },
{ age: { between: [32, 64] } },
{ not: {
or: [
{ favoriteFood: { eq: 'pizza' } },
{ favoriteFood: { eq: 'tacos' } },
]
}}
]
}
GraphQL style filter node.
using the PK values from the given
model
(which can be a partial of T Creates a predicate that matches an instance described bymodelDefinition
that contains only PK field values.)