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.git


The following commit(s) were added to refs/heads/main by this push:
     new ef25ea23d feat(go): add missing type resolver for uint{16,32,64}slice 
(#3311)
ef25ea23d is described below

commit ef25ea23d0ff78f616162c0f718ffafaa807f1a2
Author: Chang-Yen (Brian) Li <[email protected]>
AuthorDate: Mon Feb 9 01:49:08 2026 -0600

    feat(go): add missing type resolver for uint{16,32,64}slice (#3311)
    
    ## Why?
    
    
    
    The `uint` serializer and specific `uint16`, `uint32`, `uint64` slice
    serializers were implemented but missing from the `TypeResolver`
    registration and dispatch logic. This caused `not supported` errors when
    using these types.
    
    ## What does this PR do?
    
    
    
    1.  **Type Registration**:
    * Registers `uint16Type`, `uint32Type`, and `uint64Type` in
    `newTypeResolver` initialization to ensure `decodeType` can correctly
    resolve these type strings.
    
    2.  **Serializer Dispatch**:
    * Updates `createSerializer` in `type_resolver.go` to correctly dispatch
    to the existing optimized `uint16SliceSerializer`,
    `uint32SliceSerializer`, and `uint64SliceSerializer` for the
    corresponding slice types.
    
    3.  **Tests**:
    * Adds test cases in `TestTypeResolver` (`type_test.go`) to verify that
    `[]uint16`, `[]uint32`, and `[]uint64` are correctly resolved and
    serialized.
    
    ## Related issues
    
    
    ## Does this PR introduce any user-facing change?
    
    
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
---
 go/fory/type_resolver.go | 9 +++++++++
 go/fory/type_test.go     | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/go/fory/type_resolver.go b/go/fory/type_resolver.go
index bd49a03e1..3363508ed 100644
--- a/go/fory/type_resolver.go
+++ b/go/fory/type_resolver.go
@@ -248,6 +248,9 @@ func newTypeResolver(fory *Fory) *TypeResolver {
        for _, t := range []reflect.Type{
                boolType,
                byteType,
+               uint16Type,
+               uint32Type,
+               uint64Type,
                int8Type,
                int16Type,
                int32Type,
@@ -1704,6 +1707,12 @@ func (r *TypeResolver) createSerializer(type_ 
reflect.Type, mapInStruct bool) (s
                case reflect.Uint8:
                        // []byte uses byteSliceSerializer
                        return byteSliceSerializer{}, nil
+               case reflect.Uint16:
+                       return uint16SliceSerializer{}, nil
+               case reflect.Uint32:
+                       return uint32SliceSerializer{}, nil
+               case reflect.Uint64:
+                       return uint64SliceSerializer{}, nil
                case reflect.String:
                        return stringSliceSerializer{}, nil
                }
diff --git a/go/fory/type_test.go b/go/fory/type_test.go
index bbb890be5..952a3882c 100644
--- a/go/fory/type_test.go
+++ b/go/fory/type_test.go
@@ -43,6 +43,9 @@ func TestTypeResolver(t *testing.T) {
                        "[]map[string][]map[string]*interface {}"},
                {reflect.TypeOf((*A)(nil)), "*@example.A"},
                {reflect.TypeOf((*A)(nil)).Elem(), "@example.A"},
+               {reflect.TypeOf([]uint16{}), "[]uint16"},
+               {reflect.TypeOf([]uint32{}), "[]uint32"},
+               {reflect.TypeOf([]uint64{}), "[]uint64"},
                {reflect.TypeOf((*[]map[string]int)(nil)), "*[]map[string]int"},
                {reflect.TypeOf((*[]map[A]int)(nil)), "*[]map[@example.A]int"},
                {reflect.TypeOf((*[]map[string]*A)(nil)), 
"*[]map[string]*@example.A"},


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to