You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6197e29
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/adr/0002-one-value-model-three-encodings-and-eql-v4-by-producer.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,7 +168,7 @@ bundle (see Consequences). Chosen.
168
168
|`0x0E`, `0x0F`|`Int16`, `UInt16`| 2 bytes, little-endian; two's complement for `Int16`|
169
169
|`0x10`, `0x11`|`Int128`, `UInt128`| 16 bytes, little-endian; two's complement for `Int128`|
170
170
|`0x12`|`Date`|`i32`, little-endian: the day number in the proleptic Gregorian calendar with **0001-01-01 as day 1** (chrono's `num_days_from_ce`). 0001-01-01 is `01 00 00 00`, not zero |
171
-
|`0x13`|`Timestamp`|`i64` Unix seconds, then `u32` nanoseconds, both little-endian, UTC. Nanoseconds are below 1,000,000,000, except at a leap second (seconds modulo 60 is 59), where they may go up to 1,999,999,999 (chrono's representation). Anything else is refused |
171
+
|`0x13`|`Timestamp`|`i64` Unix seconds, then `u32` nanoseconds, both little-endian, UTC. Nanoseconds are below 1,000,000,000. *Amended 2026-10-18 (#1144):* vitaminc 0.6 refuses a leap second: nanoseconds of 1,000,000,000 or more (chrono's leap-second representation, which the pre-ADR-0001 `Value` codec accepted when the seconds modulo 60 were 59) are refused, because a leap second has no count in any unit. The instant must also lie within chrono's `NaiveDateTime` range (vitaminc's `MIN_TIMESTAMP_NANOS` to `MAX_TIMESTAMP_NANOS`, years -262143 to 262142). Anything else is refused |
172
172
|`0x14`|`Decimal`| 16 bytes: a little-endian `u32` of flags (sign in bit 31, scale in bits 16–23 and at most 28, every other bit zero), then the low, middle and high little-endian `u32` words of the 96-bit mantissa. This is rust_decimal's `serialize()` and keeps the scale. There is no NaN or infinity |
173
173
174
174
-`transport` stays a module of `vitaminc-aead-value`.
@@ -353,6 +353,13 @@ without loss, and refuses it otherwise.
353
353
`uint8` and `uint16` get their own kinds when a target names them; no
354
354
target does yet, so today they reach `Int16`, `Int32` or `Int64` through
355
355
the fits-losslessly rule.
356
+
*Amended 2026-10-18 (#1144):* a field with no EQL target (`encrypt`,
357
+
`index=`) has no target to pick a kind from, so Go picks it from the Go
358
+
type: each integer type is its own kind (`int8` is `Int8`, `int16`
359
+
`Int16`, `uint8``UInt8`, `uint16``UInt16`, `int` and `int64``Int64`,
360
+
`uint` and `uint64``UInt64`), and its order terms are that width's. A
361
+
field stored as an EQL target still takes the target's kind, by the rule
362
+
above.
356
363
`Int128` and `Uint128` are SDK value types. `time.Time` means `Timestamp`,
357
364
and `encrypt.Date{Year, Month, Day}` is a date. A field whose target is a
358
365
date family also accepts `time.Time` and takes its calendar day **in the
Copy file name to clipboardExpand all lines: languages/golang/cmd/stashgen/README.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,15 +159,15 @@ The engine produces these EQL types today, each from one Go field type:
159
159
|`encrypt_into`| Go field |
160
160
|---|---|
161
161
|`TextEq`, `Text`, `TextMatch`|`string`|
162
-
|`Integer`, `IntegerEq`|`int32`|
163
-
|`Bigint`, `BigintEq`|`int64`|
162
+
|`Integer`, `IntegerEq`|`int32`, or any Go integer type|
163
+
|`Bigint`, `BigintEq`|`int64`, or any Go integer type|
164
164
|`Boolean`|`bool`|
165
165
|`Real`, `RealEq`|`float32`|
166
166
|`Double`, `DoubleEq`|`float64`|
167
167
168
168
The `Eq` types answer `Eq`; `Text`, `Integer`, `Bigint`, `Boolean`, `Real` and `Double` are stored and read only, with no query method.
169
169
170
-
The width must match: an `int` or `int64` field is not an `Integer`, and a `float64` field is not a `Real`.
170
+
Any built-in Go integer field takes an integer type (ADR-0002) and seals at the type's width: an `int16` field always fits an `Integer`, and an `int64` field is range checked value by value, `Encrypt` refusing a value that does not fit with `encrypt.ErrEncoding`. `encrypt.Int128`and`encrypt.Uint128` are not converted. A float's width must match: a `float64` field is not a `Real`.
171
171
A `TextMatch` field refuses text shorter than three characters, such as an empty string or a two-letter code, because it has no 3-grams to index; its query refuses such text too.
172
172
Put the column on the left of `@@` (`WHERE name @@ $1::eql_v4.query_text_match`): the other operand order finds nothing until #1171 is fixed.
173
173
`encrypt_into` with any other type is refused with the type's name and the reason it is not produced yet.
@@ -240,10 +240,13 @@ No warning, error or log line holds a plaintext value.
240
240
## What crosses the binding
241
241
242
242
Generated code sends the engine every sealed field with its value, under the declaration lowered to data: each field's label (`<context>/<name>`), its outputs and its wire type (`int64`, `string`, `bytes`, ...), which `stashgen` chose from the field's Go type.
243
-
A passthrough field stays on the host: the engine does nothing to it a program could observe, and the FFI codec cannot carry every Go type a program stores beside a ciphertext.
243
+
A passthrough field stays on the host: the engine does nothing to it a program could observe, and the FFI codec cannot carry every Go type a program stores beside a ciphertext (a `driver.Valuer`, a `sql.NullTime`).
244
244
An `opaque` struct crosses as one JSON document and is one column, decoded back into the exact Go types the struct declares; a field may be any type `encoding/json` carries both ways (a scalar or a type defined over one, `[]byte`, slices, maps with string or integer keys, pointers, structs whose fields are all exported, `time.Time`).
245
245
A float in an opaque struct must be finite: `encoding/json` refuses NaN and the infinities, so `Encrypt` fails for the batch with `encrypt.ErrEncoding`. A sealed float field outside an opaque struct carries them.
246
246
A sealed field outside an opaque struct is one scalar, or a type defined over one; a struct, slice or map field seals only inside an opaque struct.
247
+
The scalars are `string`, `[]byte`, `bool`, every integer type (each sealed at its own width, `int` and `uint` as 64-bit), `encrypt.Int128` and `encrypt.Uint128`, `float32`, `float64`, `encrypt.Decimal`, `encrypt.Date` and `time.Time` (a timestamp). The wire type `stashgen` writes for each is the field's own: `int8` is `gensupport.Int8`, `time.Time` is `gensupport.Timestamp`, and so on.
248
+
An order index (`ore`, `ope`) on a decimal, date or timestamp is refused: those order terms wait for new cllw-ore and ore-rs releases (#1236).
249
+
The zero `encrypt.Date` is not a date: a date field must be set, and `Encrypt` refuses a zero one with `encrypt.ErrEncoding`, naming the field. A sealed field cannot be a pointer (`*encrypt.Date` is refused as a composite), so an optional date has no sealed form yet: keep it in an opaque struct, or store a sentinel date.
247
250
A nil `[]byte` in a sealed field, or a nil slice of a type defined over `[]byte`, comes back from `Decrypt` as an empty, non-nil slice; inside an opaque struct, nil comes back as nil.
248
251
A protobuf message with a `oneof` cannot be generated from a policy: protoc-gen-go puts its members in wrapper types, not in the message struct, and `Generate` refuses it.
| `index=ore` or `index=ope`, on an integer | `Lt`, `Lte`, `Gt`, `Gte` | `encrypt.OreTerm`, or `encrypt.OpeTerm` when the field declares no `ore` |
282
+
| `index=ore` or `index=ope`, on an integer of any width | `Lt`, `Lte`, `Gt`, `Gte` | `encrypt.OreTerm`, or `encrypt.OpeTerm` when the field declares no `ore` |
247
283
| the same | `Between(ctx, cipher, lo, hi)` | `encrypt.Range[encrypt.OreTerm]` or `encrypt.Range[encrypt.OpeTerm]`, the two bounds' terms |
248
284
| `index=match`, on a string | `Matches` | `encrypt.MatchQuery[T]` |
0 commit comments