Support struct tags #5

Open
opened 2025-06-27 11:26:30 -06:00 by sashakoshka · 1 comment
Owner

We will be having new functions in TAPE called EncodeAny and DecodeAny (subject to change) which will be able to take in an any value and encode it to an encoder or decode it from a decoder. Structs should be supported (when a KTV value is encountered) as long as they have struct tags. Such a struct would look something like this:

type Thing struct {
        SomeField string `tape:"0000"`
        OtherField string `tape:"0001"`
        AnotherField string `tape:"0002"`
}

The tag's value would correspond to the field's table key, and it would be hexadecimal ranging 0000-FFFF, and exactly 4 digits to emphasize that it is not a decimal number.

We will be having new functions in TAPE called EncodeAny and DecodeAny (subject to change) which will be able to take in an `any` value and encode it to an encoder or decode it from a decoder. Structs should be supported (when a KTV value is encountered) as long as they have struct tags. Such a struct would look something like this: ```go type Thing struct { SomeField string `tape:"0000"` OtherField string `tape:"0001"` AnotherField string `tape:"0002"` } ``` The tag's value would correspond to the field's table key, and it would be hexadecimal ranging 0000-FFFF, and exactly 4 digits to emphasize that it is not a decimal number.
Author
Owner

When this change is implemented, merged, and released, we must add tape to this list: https://go.dev/wiki/Well-known-struct-tags

With a link to the HOPP repository. Maybe we should change the module name before, though.

When this change is implemented, merged, and released, we must add `tape` to this list: https://go.dev/wiki/Well-known-struct-tags With a link to the HOPP repository. Maybe we should change the module name before, though.
sashakoshka added a new dependency 2025-06-27 11:36:12 -06:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: sashakoshka/hopp#5
No description provided.