KeyValue

KeyValue Type

Represents a flexible key-value store for configuration settings, user preferences, and custom data. KeyValue entities allow storing structured data with optional schema validation through DataTypes.

Fields

Field
Type
Description

id

ID!

Unique identifier of the key-value pair

tenantID

UUID!

Tenant identifier

userID

UUID

User identifier (optional, for user-specific settings)

dataTypeID

UUID

DataType identifier for schema validation

dataTypeSlug

String

DataType slug for easier reference

data

Map

The actual key-value data stored as JSON

createdAt

Time!

Creation timestamp

createdBy

UUID!

User identifier who created the entry

updatedAt

Time

Last update timestamp

updatedBy

UUID

User identifier who last updated the entry

deletedAt

Time

Deletion timestamp

deletedBy

UUID

User identifier who deleted the entry

name

String!

Name/key identifier for the value

Interfaces

  • Node

Usage Example

Mutation Examples

Set a Key-Value Pair

Delete a Key-Value Pair

Common Use Cases

  • User Preferences: Store user-specific settings like theme, language, and dashboard configurations

  • System Configuration: Store application-wide settings and feature flags

  • Custom Metadata: Attach flexible data to entities without schema changes

  • Temporary Storage: Store session data or temporary workflow state

  • Integration Settings: Store third-party API configurations and credentials

Data Validation

KeyValue entries can optionally reference a DataType for schema validation:

  • Use dataTypeID to reference a specific DataType entity

  • Use dataTypeSlug for easier reference to common schema types

  • The data field will be validated against the DataType's JSON schema

  • Validation ensures data integrity and consistency across the application

Last updated

Was this helpful?