StoreQueries
See source codeA class that provides a 'namespace' for the various kinds of indexes one may wish to derive from the record store.
class StoreQueries<R extends UnknownRecord> {}Constructor
Constructs a new instance of the StoreQueries class
Parameters
| Name | Description | 
|---|---|
  |  | 
  |  | 
Methods
exec()
exec<TypeName extends R['typeName']>(
  typeName: TypeName,
  query: QueryExpression<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >
): Array<
  Extract<
    R,
    {
      typeName: TypeName
    }
  >
>Parameters
| Name | Description | 
|---|---|
  |  | 
  |  | 
Returns
Array<
  Extract<
    R,
    {
      typeName: TypeName
    }
  >
>filterHistory()
Create a derivation that contains the history for a given type
filterHistory<TypeName extends R['typeName']>(
  typeName: TypeName
): Computed<
  number,
  RecordsDiff<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >
>Parameters
| Name | Description | 
|---|---|
  | The name of the type to filter by.  | 
Returns
Computed<
  number,
  RecordsDiff<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >
>A derivation that returns the ids of all records of the given type.
ids()
Create a derivation that will return the ids of all records of the given type.
ids<TypeName extends R['typeName']>(
  typeName: TypeName,
  queryCreator?: () => QueryExpression<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >,
  name?: string
): Computed<
  Set<
    IdOf<
      Extract<
        R,
        {
          typeName: TypeName
        }
      >
    >
  >,
  CollectionDiff<
    IdOf<
      Extract<
        R,
        {
          typeName: TypeName
        }
      >
    >
  >
>Parameters
| Name | Description | 
|---|---|
  | The name of the type.  | 
  | A function that returns the query expression.  | 
  | (optinal) The name of the query.  | 
Returns
Computed<
  Set<
    IdOf<
      Extract<
        R,
        {
          typeName: TypeName
        }
      >
    >
  >,
  CollectionDiff<
    IdOf<
      Extract<
        R,
        {
          typeName: TypeName
        }
      >
    >
  >
>index()
Create a derivation that returns an index on a property for the given type.
index<
  TypeName extends R['typeName'],
  Property extends string &
    keyof Extract<
      R,
      {
        typeName: TypeName
      }
    >,
>(
  typeName: TypeName,
  property: Property
): RSIndex<
  Extract<
    R,
    {
      typeName: TypeName
    }
  >,
  Property
>Parameters
| Name | Description | 
|---|---|
  | The name of the type.  | 
  | The name of the property.  | 
Returns
RSIndex<
  Extract<
    R,
    {
      typeName: TypeName
    }
  >,
  Property
>record()
Create a derivation that will return a signle record matching the given query.
It will return undefined if there is no matching record
record<TypeName extends R['typeName']>(
  typeName: TypeName,
  queryCreator?: () => QueryExpression<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >,
  name?: string
): Computed<
  | Extract<
      R,
      {
        typeName: TypeName
      }
    >
  | undefined
>Parameters
| Name | Description | 
|---|---|
  | The name of the type?  | 
  | A function that returns the query expression.  | 
  | (optinal) The name of the query.  | 
Returns
Computed<
  | Extract<
      R,
      {
        typeName: TypeName
      }
    >
  | undefined
>records()
Create a derivation that will return an array of records matching the given query
records<TypeName extends R['typeName']>(
  typeName: TypeName,
  queryCreator?: () => QueryExpression<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >,
  name?: string
): Computed<
  Array<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >
>Parameters
| Name | Description | 
|---|---|
  | The name of the type?  | 
  | A function that returns the query expression.  | 
  | (optinal) The name of the query.  | 
Returns
Computed<
  Array<
    Extract<
      R,
      {
        typeName: TypeName
      }
    >
  >
>