Amplify JS API Documentation
    Preparing search index...
    Index

    Constructors

    Methods

    • using the PK values from the given model (which can be a partial of T Creates a predicate that matches an instance described by modelDefinition that contains only PK field values.)

      Type Parameters

      • T extends Readonly<Record<string, any>>

      Parameters

      • modelDefinition: SchemaModel

        The model definition to create a predicate for.

      • model: T

        The model instance to extract value equalities from.

      Returns ModelPredicate<T>

    • Accepts 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' } },
      ]
      }}
      ]
      }

      Type Parameters

      • T extends Readonly<Record<string, any>>

      Parameters

      • modelDefinition: SchemaModel

        The model that the AST/predicate must be compatible with.

      • ast: any

        The graphQL style AST that should specify conditions for modelDefinition.

      Returns ModelPredicate<T>

    • Searches 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.

      Type Parameters

      • T extends Readonly<Record<string, any>>

      Parameters

      • modelDefinition: SchemaModel

        The model we need a predicate for.

      • flatEqualities: Record<string, any>

        An object holding field equalities to search for.

      Returns ModelPredicate<T>

    • Looks 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().

      Type Parameters

      • T extends Readonly<Record<string, any>>

      Parameters

      • predicate: ModelPredicate<T>

        The predicate reference to look up.

      • OptionalthrowOnInvalid: boolean

        Whether to throw an exception if the predicate isn't a valid DataStore predicate.

      Returns PredicatesGroup<any>

    • Determines whether the given storage predicate (lookup key) is a predicate key that DataStore recognizes.

      Type Parameters

      • T extends Readonly<Record<string, any>>

      Parameters

      • predicate: any

        The storage predicate (lookup key) to test.

      Returns predicate is ModelPredicate<T>

    • Accepts 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' } },
      ]
      }}
      ]
      }

      Parameters

      • gql: any

        GraphQL style filter node.

      Returns any