Skip to content

Latest commit

 

History

History
584 lines (417 loc) · 10.1 KB

File metadata and controls

584 lines (417 loc) · 10.1 KB

Table of Contents

Field Types

A field can represent a simple column in a database or a more complex structure, such as one-to-many (1:N) or many-to-many (N:N) relationships.

This approach:

  • Simplifies the learning and implementation of Rapidex for developers.
  • Makes it easier for users of applications built with Rapidex to customize their solutions.

string

A text field with a maximum length of 250 characters.

JSON Type string
C# Type string
SQL Type nvarchar(250)
SQLite Type ---
PostgreSQL Type ---
Length 250
Lazy Loading No

byte

An 8-bit integer field.


short

A 16-bit integer field.


int (int32)

A 32-bit integer field.


long (int64)

A 64-bit integer field.


double (float)

A 64-bit floating-point number field.


decimal

A 128-bit decimal number field.


datetime

A date and time field.

JSON Type datetime, datetimeoffset, date, time
C# Type DateTimeOffset
SQL Type datetime2
SQLite Type ---
PostgreSQL Type ---
Length ---
Lazy Loading No

date

Date-only field.
Not yet implemented.


time

Time-only field.
Not yet implemented.


timespan (datetimediff)

Time span field stored as Int64.
Not yet implemented.


guid

A GUID field.


bool (boolean, yesno)

A logical value field.

JSON Type bool, boolean, yesno
C# Type bool
SQL Type bit
SQLite Type ---
PostgreSQL Type ---
Length ---
Lazy Loading No

binary (byte[])

A binary/blob data field.

JSON Type binary, byte[]
C# Type byte[]
SQL Type varbinary(max)
SQLite Type ---
PostgreSQL Type ---
Length Unlimited
Lazy Loading No

xml

Not yet implemented.


currency

See: Currency.cs
A currency field. This type automatically adds an extra text field named <FieldName>Currency (Eq: For Price field, it will add PriceCurrency type field) to store the ISO 4217 currency code.

JSON Type currency
C# Type Currency
SQL Type decimal
SQLite Type ---
PostgreSQL Type ---
Length 24,8
Lazy Loading No
Extra Field Yes: Adds <FieldName>Currency

percentage

Stores percentage values

JSON Type percent
C# Type Percent
SQL Type short
SQLite Type ---
PostgreSQL Type ---
Length 2
Lazy Loading No

Note

This field type is basic short type with a different name. For to be distinguishable on the UI side.


phone

See: Phone.cs

JSON Type phone
C# Type Phone
SQL Type nvarchar(20)
SQLite Type ---
PostgreSQL Type ---
Length 20
Lazy Loading No

email

See: Email.cs

JSON Type email
C# Type Email
SQL Type nvarchar(200)
SQLite Type ---
PostgreSQL Type ---
Length 200
Lazy Loading No

url

Not yet implemented.


color

Stores a color value as a hex string or color name.
Custom-defined for UI support (e.g., color picker).

JSON Type color
C# Type Color
SQL Type nvarchar(20)
SQLite Type ---
PostgreSQL Type ---
Length 20
Lazy Loading No

datetimeStartEnd

Represents a start and end date/time pair.

JSON Type datetimeStartEnd
C# Type DatetimeStartEnd
SQL Type Virtual field
SQLite Type ---
PostgreSQL Type ---
Length ---
Lazy Loading No
Extra Fields Yes: Adds <FieldName>Start and <FieldName>End

Note:
The datetimeStartEnd field is virtual and relies on two underlying fields: <FieldName>Start and <FieldName>End. Eg: For EventPeriod field, it will add EventPeriodStart and EventPeriodEnd fields with type datetime.


image

A binary blob field for images.

JSON Type image
C# Type Image
SQL Type varbinary(max)
SQLite Type ---
PostgreSQL Type ---
Lazy Loading Yes

Lazy Loading

  • Value is stored in a BlobRecord entry and not loaded directly with the entity.
  • Use GetContent() to retrieve the content.

Sample API response:

"FieldName": {
   "value": "<BlobRecordId>",
   "text": "picture",
   "id": "<schemaName>.<OwnerEntityName>.<OwnerEntityId>.<FieldName>"
}

See: abc


reference

A one-to-one reference field.

C# Type Reference<>
JSON Type reference (requires target entity name)
SQL Type int64
SQLite Type ---
PostgreSQL Type ---
Lazy Loading Yes

Note: Cross-schema usage is not yet implemented.


tags

A tag field, used only with HasTags behavior.

C# Type Tags
JSON Type tags
SQL Type string
SQLite Type ---
PostgreSQL Type ---
Lazy Loading No

text

An unlimited-length text field (blob) with support for different content types (plain text, HTML, Markdown).

C# Type Text
JSON Type text
SQL Type nvarchar(max)
SQLite Type ---
PostgreSQL Type ---
Lazy Loading No
Extra Field Yes: Adds <FieldName>Type

Type values:

Value Description
null or text Plain text
html HTML content
markdown Markdown content

See: abc


json

A text field with unlimited length. Practically, there is no difference from Text in the UI (for now).

C# Type Json
JSON Type json
SQL Type nvarchar(max)
SQLite Type ---
PostgreSQL Type ---
Lazy Loading No

vector (float[])

A vector field for numerical data, commonly used for ML or embeddings.

JSON Type vector
C# Type vector
SQL Type vector
SQLite Type ---
PostgreSQL Type ---
Length 1024
Lazy Loading No

Not yet implemented.

YAML Definition

vector:
  type: vector
  length: 1024

password

A field for encrypted data with two-way encryption (encrypt/decrypt).

C# Type Password
JSON Type password
SQL Type nvarchar(200)
SQLite Type ---
PostgreSQL Type ---
Lazy Loading No

Details

  • Encrypted information is stored in the Value property of Password objects.
  • Use Password.Decrypt() to decrypt values.
  • During JSON serialization, the actual password is hidden and replaced with *****.
  • Encryption uses the schema name and entity ID. Copying encrypted data to another schema/entity will make it non-decryptable.

See: abc


oneWayPassword

A field for one-way encrypted (non-reversible) passwords (hash).
Use OneWayPassword.IsEqual() to compare input values.

C# Type OneWayPassword
JSON Type oneWayPassword
SQL Type nvarchar(200)
SQLite Type ---
PostgreSQL Type ---
Lazy Loading No

Details

  • Stores irreversible encrypted data.
  • JSON serialization masks the content as *****.

See: abc


relationOne2N

Represents a One-to-Many relationship.

C# Type RelationOne2N
JSON Type relationOne2N (requires target entity in reference)
SQL Type int64
SQLite Type ---
PostgreSQL Type ---
Lazy Loading Yes

Lazy Loading

  • For concrete types: Implicit conversion to DetailEntity[]. Use GetContent() for lazy fetch.
  • For dynamic/JSON: Use ILazy.GetContent().

Example Metadata

A Parent<ParentEntityName> field is added to the detail entity (e.g., ParentInvoice).

Data Update

Add/Remove Relation

See: abc

{
  "UpdType": "AddRelation",
  "Relation": "<MasterEntityName>/<FieldName>",
  "MasterId": <master entity Id (can be premature)>,
  "DetailId": <detail entity Id (can be premature)>
}
{
  "UpdType": "RemoveRelation",
  "Relation": "<MasterEntityName>/<FieldName>",
  "MasterId": <master entity Id (can't be premature)>,
  "DetailId": <detail entity Id (can't be premature)>
}

Example:

{
  "UpdType": "AddRelation",
  "Relation": "Project/Tasks",
  "MasterId": -1000,
  "DetailId": -1001
}
{
  "UpdType": "RemoveRelation",
  "Relation": "Project/Tasks",
  "MasterId": 1000,
  "DetailId": 1234
}

relationN2N

Represents a Many-to-Many relationship.

C# Type RelationN2N
JSON Type relationN2N (requires target entity in reference)
SQL Type int64
SQLite Type ---
PostgreSQL Type ---
Lazy Loading Yes

See: abc

Lazy Loading

  • For concrete types: Implicit conversion to OtherEntity[]. Use GetContent() for lazy fetch.
  • For dynamic/JSON: Not yet implemented.

Details

A linking table will be created for N2N relationships (details pending).


enumeration

C# Type Enumeration (T: C# Enum)
JSON Type enum (requires entity name for values)
SQL Type int32
SQLite Type ---
PostgreSQL Type ---
Lazy Loading No

Details

  • Enum values are stored in the database as entities matching the C# enum name.
  • JSON serialization is not yet implemented.