You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by ch...@apache.org on 2026/05/01 03:16:48 UTC
(fory-site) branch main updated (7fd1fca06b -> 648bd79ccb)
This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
from 7fd1fca06b 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
new 2510a252d8 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
new 648bd79ccb 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
docs/compiler/generated-code.md | 4 ++--
docs/guide/go/struct-tags.md | 28 ++++++++++++++++++++++------
2 files changed, 24 insertions(+), 8 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org
(fory-site) 01/02: 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 2510a252d8e200d05053e75032a426ed101b9712
Author: chaokunyang <sh...@gmail.com>
AuthorDate: Fri May 1 03:16:43 2026 +0000
🔄 synced local 'docs/guide/' with remote 'docs/guide/'
---
docs/guide/go/struct-tags.md | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/docs/guide/go/struct-tags.md b/docs/guide/go/struct-tags.md
index 742aa9df1f..b973769eb2 100644
--- a/docs/guide/go/struct-tags.md
+++ b/docs/guide/go/struct-tags.md
@@ -152,17 +152,33 @@ type Metrics struct {
- `fixed`: Best for values that use full range (e.g., timestamps, hashes)
- `tagged`: When type information needs to be preserved
-**Shorthand for int32/uint32**:
+### Type Overrides
-Use `compress` as a convenience tag for int32/uint32 fields:
+Use `type=` to override inferred carrier semantics or nested value encoding:
```go
-type Data struct {
- SmallValue int32 `fory:"compress"` // Same as encoding=varint (default)
- FixedValue uint32 `fory:"compress=false"` // Same as encoding=fixed
+type Foo struct {
+ // Force general LIST protocol instead of inferred packed INT32_ARRAY
+ Values []int32 `fory:"type=list"`
+
+ // Override inner integer encoding for a general list
+ FixedValues []int32 `fory:"type=list(element=int32(encoding=fixed))"`
+
+ // Override nested map/list integer encoding
+ Nested map[string][]*uint64 `fory:"type=map(value=list(element=uint64(encoding=tagged)))"`
+
+ // Preserve the inferred packed inner carrier and only override descendants
+ Packed map[string][]int32 `fory:"type=map(value=_(element=int32(encoding=fixed)))"`
}
```
+**Notes**:
+
+- `list(...)`, `set(...)`, and `map(...)` are explicit container overrides
+- `_` keeps the inferred Go branch at that position and only overrides nested descendants
+- There is no public `array(...)` tag. Packed primitive arrays are inferred from Go `[]T` / `[N]T` when the final element spec is packable
+- Explicit `type=list(...)` always stays general LIST protocol and never collapses into a packed primitive array
+
## Combining Tags
Multiple tags can be combined using comma separator:
@@ -171,7 +187,7 @@ Multiple tags can be combined using comma separator:
type Document struct {
ID int64 `fory:"id=0,encoding=fixed"`
Content string `fory:"id=1"`
- Author *User `fory:"id=2,ref"`
+ Author *User `fory:"id=2,nullable=false,ref"`
}
```
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org
(fory-site) 02/02: 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 648bd79ccb446bb6337bf3b592254bd421e2fe00
Author: chaokunyang <sh...@gmail.com>
AuthorDate: Fri May 1 03:16:43 2026 +0000
🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
---
docs/compiler/generated-code.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/compiler/generated-code.md b/docs/compiler/generated-code.md
index 5098fb2af6..a517f4f952 100644
--- a/docs/compiler/generated-code.md
+++ b/docs/compiler/generated-code.md
@@ -597,8 +597,8 @@ Messages generate structs with `fory` tags and byte helpers:
```go
type Person struct {
Name string `fory:"id=1"`
- Id int32 `fory:"id=2,compress=true"`
- Phones []Person_PhoneNumber `fory:"id=7"`
+ Id int32 `fory:"id=2"`
+ Phones []Person_PhoneNumber `fory:"id=7,type=list"`
Pet Animal `fory:"id=8"`
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org