diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-06-30 13:31:56 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-06-30 13:31:56 -0700 |
| commit | 437415ca92a98783d03e71c689bdbb58fe0a8d51 (patch) | |
| tree | 0fcba8be50cc1fee3e26a9bc80ff3c81330bf9e1 /hotline/transaction.go | |
| parent | 2bef32a36300e64106a27851fe1eab349d2dbeef (diff) | |
Add type safety to field system with FieldType alias
- Define FieldType as typed alias for [2]byte to improve type safety
- Update all 47 field constants to use FieldType instead of raw [2]byte
- Update Field struct to use FieldType for Type field
- Update function signatures: NewField, GetField, Transaction.GetField
- Fix field_test.go to use new FieldType in test cases
- Maintains backward compatibility with zero runtime overhead
- Enhances API clarity and prevents accidental field type misuse
Diffstat (limited to 'hotline/transaction.go')
| -rw-r--r-- | hotline/transaction.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hotline/transaction.go b/hotline/transaction.go index fa1e96d..a03030d 100644 --- a/hotline/transaction.go +++ b/hotline/transaction.go @@ -275,7 +275,7 @@ func (t *Transaction) Size() []byte { return bs } -func (t *Transaction) GetField(id [2]byte) *Field { +func (t *Transaction) GetField(id FieldType) *Field { for _, field := range t.Fields { if id == field.Type { return &field |