File

src/api/dataops/dataset.ts

Description

Dataset object used to fetch and modify data at your datasets. For TypeScript users it implements a generic type T that represents your dataset, default to any. This object must be build from the data operations module, never to be instantiated directly.

Example

```typescript

  • import { jexiaClient, dataOperations } from "jexia-sdk-js/node";
  • const dataModule = dataOperations();
  • jexiaClient().init(credentials, dataModule);
  • dataModule.dataset("posts")
  • .select()
  • .execute()
  • .then((data) => {
  • // you have been succesfully logged in!
  • // you can start using the dataModule variable to operate on records here
  • }).catch((error) => {
  • // uh-oh, there was a problem logging in, check the error.message for more info
  • });
  • ```

Example

Index

Properties
Methods
Accessors

Methods

Public attach
attach(resourceName: string, filter: IFilteringCriterion | IFilteringCriterionCallback | IdentityCollection)

Creates an Attach query.

Parameters :
Name Type Optional Description
resourceName string No

The name of the resource to be attached.

filter IFilteringCriterion<D> | IFilteringCriterionCallback<D> | IdentityCollection<D> No

Filtering criterion or a callback that returns one, that will be applied to the resource to be attached.

Returns : ActionQuery<T, D>

ActionQuery object specialized for attaching resources to the current one.

Public delete
delete()

Creates a Delete query

Returns : DeleteQuery<D>

Query object specialized for delete statements You need to specify a filter to narrow down the records that you want deleted from the backend.

Public detach
detach(resourceName: string, filter: IFilteringCriterion | IFilteringCriterionCallback | IdentityCollection)

Creates a Detach query.

Parameters :
Name Type Optional Description
resourceName string No

The name of the resource to be detached.

filter IFilteringCriterion<D> | IFilteringCriterionCallback<D> | IdentityCollection<D> No

Filtering criterion or a callback that returns one, that will be applied to the resource to be detached.

Returns : ActionQuery<T, D>

ActionQuery object specialized for detaching resources from the current one.

Public insert
insert(data: Array> | Partial)

Creates an Insert query.

Parameters :
Name Type Optional Description
data Array<Partial<D>> | Partial<D> No

A dictionary that contains the key:value pairs for the fields you want to store at this dataset or an array of those.

Returns : InsertQuery<D>

Query object specialized for insert statements If saving into a strict schema dataset, you need to provide values for the required fields for that particular dataset.

Public select
select()

Creates a Select query.

Returns : SelectQuery<D>

Query object specialized for select statements. With no filters set, returns all records in the selected dataset.

Public update
update(data: T)

Creates an Update query.

Parameters :
Name Type Optional Description
data T No

Dictionary that contains the key:value pairs for the fields that you want to modify of this dataset

Returns : UpdateQuery<T>

Query object specialized for update statements. Don't forget to apply a filter to specify the fields that will be modified.

Properties

Public Readonly resourceType
Type : ResourceType
Default value : ResourceType.Dataset

Resource type of the dataset

Accessors

name
getname()

Name of the working dataset.

Returns : string

result-matching ""

    No results matching ""