File size: 2,902 Bytes
f14b4e9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | # Fields
Fields are typed key-value pairs attached to an entity. Firm supports a rich set of types to represent your business data.
## Field types
### String
Text values:
```firm
person john {
name = "John Doe"
bio = "Software engineer and entrepreneur"
}
```
For multiline strings, use triple quotes.
```firm
project website {
description = """
# Complete redesign
Includes new homepage, about page, and contact form.
"""
}
```
Common indentation across the multiline string is removed when parsed.
### Integer
Numbers without a decimal place:
```firm
task design {
priority = 1
estimated_hours = 40
}
```
### Float
Numbers with a decimal place:
```firm
person john {
height = 1.75
weight = 70.5
}
```
### Boolean
True or false values:
```firm
task design {
completed = false
billable = true
}
```
### Currency
Monetary values with currency codes:
```firm
project website {
budget = 5000.00 USD
spent = 2500.00 USD
}
```
Firm supports ISO 4217 currency codes (USD, EUR, GBP, JPY, etc.).
### DateTime
Dates and times support three variants:
```firm
task design {
# Date only (YYYY-MM-DD)
start_date = 2025-01-15
# Date and time (YYYY-MM-DD at HH:MM)
due_date = 2025-01-15 at 17:00
# Date and time with UTC offset (YYYY-MM-DD at HH:MM UTC+Z)
created = 2025-01-15 at 17:00 UTC+3
}
```
**Timezone handling:**
- When you specify just a date (like `2025-01-15`), Firm assumes midnight (00:00) in your local timezone
- When you specify date and time without a timezone (like `2025-01-15 at 17:00`), Firm uses your local timezone
- When you specify a UTC offset (like `UTC+3` or `UTC-5`), Firm uses that timezone
- If you write `UTC` with no offset, it uses UTC+0
- Only `UTC` timezone offsets are supported (`EST`, `CET`, etc. are not)
### List
Collections of values. Lists are required to have homogeneous types (all items must be the same type):
```firm
person john {
tags = ["developer", "manager", "consultant"]
skills = ["rust", "python", "javascript"]
}
```
### Reference
Links to other entities:
```firm
task design {
assignee_ref = person.jane_doe
project_ref = project.website_redesign
}
```
References create relationships in the entity graph. See [Relationships](./relationships.md) for more details.
### Path
Local file paths:
```firm
project website {
deliverable = path"./deliverables/website.zip"
contract = path"/Users/john/Documents/contracts/megacorp_contract.pdf"
}
```
Paths are specified relative to the `.firm` source file. When parsed, they are transformed to be relative to the workspace root. Absolute paths are left unchanged.
### Enum
Predefined values:
```firm
task design {
status = enum"in_progress"
priority = enum"high"
}
```
Enums are useful when combined with [schemas](./schemas.md) that define allowed values.
|