Field Types
The Field types in the Cadastry Chain schema provide a flexible way to store and manage different types of data within documents. Each field type has specific properties and use cases.
Base Field
All field types extend from the BaseField interface, which includes:
Property | Type | Description |
---|
type | FieldType | The type of the field (e.g., 'string', 'number', etc.) |
value | any | The actual value stored in the field |
hash | string (optional) | Optional hash of the field value |
encrypted | boolean (optional) | Indicates if the field is encrypted |
isPrivate | boolean (optional) | Indicates if the field is private |
decrypted | boolean (optional) | Indicates if an encrypted field has been decrypted |
Field Types
The following field types are supported (FieldType):
- string
- number
- boolean
- date
- array
- object
- generic
- reference
- resource
- encrypted
- select
- image
- url
Specific Field Types
1. StringField
Property | Type | Description |
---|
type | 'string' | Indicates this is a string field |
value | string | The string value |
2. UrlField
Property | Type | Description |
---|
type | 'url' | Indicates this is a URL field |
value | string | The URL string value |
3. NumberField
Property | Type | Description |
---|
type | 'number' | Indicates this is a number field |
value | number | The numeric value |
4. BooleanField
Property | Type | Description |
---|
type | 'boolean' | Indicates this is a boolean field |
value | boolean | The boolean value |
5. DateField
Property | Type | Description |
---|
type | 'date' | Indicates this is a date field |
value | string | ISO 8601 date string |
6. ArrayField
Property | Type | Description |
---|
type | 'array' | Indicates this is an array field |
value | any[] | Array of values |
7. ObjectField
Property | Type | Description |
---|
type | 'object' | Indicates this is an object field |
value | [key: string]: any | Object with string keys and any values |
8. GenericField
Property | Type | Description |
---|
type | 'generic' | Indicates this is a generic field |
value | any | Can hold any type of value |
9. ReferenceField
Property | Type | Description |
---|
type | 'reference' | Indicates this is a reference field |
value | string | CDID of the referenced document |
10. ResourceField
Property | Type | Description |
---|
type | 'resource' | Indicates this is a resource field |
value | string | CDID of the referenced resource document |
The Field types provide a robust system for storing and managing various types of data within the Cadastry Chain schema, allowing for flexibility and type safety. Any field can have additional properties like encrypted
, isPrivate
, and decrypted
to handle security and privacy requirements.