Database

"Database" is a product that lets you have full control of your data without the hassle of database management. You can now create/read/update/delete (CRUD) all the data you want and organize them the way you want. You can also react to any change of your database and connect workflows to automatically trigger specific features based on your data, making your application truly data-driven.

Your data are safelly stored in a Postgres Database that is attached to your Liteflow project.

Events

onCreated

Definition

By creating a trigger that listen to all the documents created in the database you will be able to trigger a workflow based on your data.

KeyTypeDescription
type"trigger"
service"database"Select the database service
eventKey"onCreated"This event is emitted when a data is created.

Example

workflow.yml
name: my-workflow
steps:
  - type: trigger
    service: database
    eventKey: onCreated
  - ...

Data

KeyTypeDescription
collectionStringThe collection used to store the data.
idStringThe id used to store the data.
valueObjectThe value stored.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.

onUpdated

Definition

By creating a trigger that listen to all the documents updated in the database you will be able to trigger a workflow based on your data.

KeyTypeDescription
type"trigger"
service"database"Select the database service
eventKey"onUpdated"This event is emitted when a data is updated.

Example

workflow.yml
name: my-workflow
steps:
  - type: trigger
    service: database
    eventKey: onUpdated
  - ...

Data

KeyTypeDescription
collectionStringThe collection used to store the data.
idStringThe id used to store the data.
valueObjectThe value stored.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.

onDeleted

Definition

By creating a trigger that listen to all the documents created in the database you will be able to trigger a workflow based on your data.

KeyTypeDescription
type"trigger"
service"database"Select the database service
eventKey"onDeleted"This event is emitted when a data is deleted.

Example

workflow.yml
name: my-workflow
steps:
  - type: trigger
    service: database
    eventKey: onDeleted
  - ...

Data

KeyTypeDescription
collectionStringThe collection used to store the data.
idStringThe id used to store the data.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.

Tasks

create

Definition

KeyTypeDescription
type"task"
service"database"Select the database service
taskKey"create"Task needed to create a data.
inputscreateInputsInputs required to create the data
Create inputs

These inputs are pre-defined Inputs. All types of Inputs are accepted including References.

KeyTypeDescription
collectionStringThe collection to use to store the data.
valueObjectThe value of the data to store.

Example

workflow.yml
name: my-workflow
steps:
  ...
  - type: task
    service: database
    taskKey: create
    inputs:
      collection: my-collection
      value:
        foo: bar
  - ...

Outputs

The result of the task returns the following information about the data.

keyTypeDescription
collectionStringThe collection used to store the data.
idStringThe id used to store the data.
valueObjectThe value stored.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.

update

Definition

KeyTypeDescription
type"task"
service"database"Select the database service
taskKey"update"Task needed to update a data.
inputsupdateInputsInputs required to update a data
Update inputs

These inputs are pre-defined Inputs. All types of Inputs are accepted including References.

KeyTypeDescription
collectionStringThe collection where your data belongs.
idStringThe id of the data you want to update.
valueObjectThe value of the data to update.

Example

workflow.yml
name: my-workflow
steps:
  ...
  - type: task
    service: database
    taskKey: update
    inputs:
      collection: my-collection
      id: XXX
      value:
        foo: bar
  - ...

Outputs

The result of the task returns the following information about the data.

keyTypeDescription
collectionStringThe collection used to store the data.
idStringThe id used to store the data.
valueObjectThe value stored.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.

get

Definition

KeyTypeDescription
type"task"
service"database"Select the database service
taskKey"get"Task needed to get a specific a data.
inputsgetInputsInputs required to get a specific data
Get inputs

These inputs are pre-defined Inputs. All types of Inputs are accepted including References.

KeyTypeDescription
collectionStringThe collection where your data belongs.
idStringThe id of the data you want to retrieve.

Example

workflow.yml
name: my-workflow
steps:
  ...
  - type: task
    service: database
    taskKey: get
    inputs:
      collection: my-collection
      id: XXX
  - ...

Outputs

The result of the task returns the following information about the data.

keyTypeDescription
collectionStringThe collection used to store the data.
idStringThe id used to store the data.
valueObjectThe data associated to the id.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.

list

Definition

KeyTypeDescription
type"task"
service"database"Select the database service
taskKey"list"Task needed to get a list of data.
inputslistInputsInputs required to get a list of data
List inputs

These inputs are pre-defined Inputs. All types of Inputs are accepted including References.

KeyTypeDescription
collectionStringThe collection where your data belongs.
conditionsmap<string,Inputs>optional Conditions to apply when listing the documents. Only documents matching all the conditions will be returned. These conditions are similar to the conditions you can use in a Filter step of a workflow. All types of Inputs are accepted including References.

Examples

workflow.yml
name: my-workflow
steps:
  ...
  - type: task
    service: database
    taskKey: list
    inputs:
      collection: my-collection
  - ...
workflow.yml
name: my-workflow
steps:
  ...
  - type: task
    service: database
    taskKey: list
    inputs:
      collection: my-collection
      conditions:
        docKeyA: constantValueToMatch # with a string constant
        docKeyB: # with a reference
          key: outputA
          stepKey: previous-step-x
  - ...

Outputs

The result of the task returns the following information about the data.

keyTypeDescription
collectionStringThe collection used to store the data.
valuesValue[]The list of data.
List outputs value
keyTypeDescription
idStringThe id used to store the data.
valueObjectThe data associated to the id.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.

delete

Definition

KeyTypeDescription
type"task"
service"database"Select the database service
taskKey"delete"Task needed to delete a specific a data.
inputsdeleteInputsInputs required to delete a specific data
Delete inputs

These inputs are pre-defined Inputs. All types of Inputs are accepted including References.

KeyTypeDescription
collectionStringThe collection where your data belongs.
idStringThe id of the data you want to retrieve.

Example

workflow.yml
name: my-workflow
steps:
  ...
  - type: task
    service: database
    taskKey: delete
    inputs:
      collection: my-collection
      id: XXX
  - ...

Outputs

The result of the task returns the following information about the data.

keyTypeDescription
collectionStringThe collection used to store the data.
idStringThe deleted id.
createdAtStringWhen the doc was created.
updatedAtStringWhen the last time this doc was updated.