You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "Nyx2022 (via GitHub)" <gi...@apache.org> on 2024/01/28 12:41:06 UTC

[I] [] unmarshal to struct [incubator-fury]

Nyx2022 opened a new issue, #1359:
URL: https://github.com/apache/incubator-fury/issues/1359

   ## Is your feature request related to a problem? Please describe.
   when i marshal a map in java,and send it by internet to a golang program,i only can unmarshal it to a interface{},but i want and need unmarshal it to a struct in golang so that i can get or set attribute easily,but no i unmarshal it to a struct ,i will get a err like:"reflect.Value.IsNil"
   
   ## Describe the solution you'd like
   support unmarshal to struct in golang
   
   ## Additional context
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [I] [Golang] unmarshal to struct [incubator-fury]

Posted by "longbai (via GitHub)" <gi...@apache.org>.
longbai commented on issue #1359:
URL: https://github.com/apache/incubator-fury/issues/1359#issuecomment-1980512960

   val := event.Query{
           Nat:    1,
           Ip:     "193.1.2.3",
           Url:    "http://baidu.com",
           Status: 0,
       }
       fury_ := fury.NewFury(true)
       if err := fury_.RegisterTagType("example.SomeClass", event.Query{}); err != nil {
           panic(err)
       }
   
       bt, err := fury_.Marshal(&val)
       if err != nil {
           b.Log(err)
           return
       }
      
          _ = fury_.Unmarshal(bt, &newval)
          }
          报错 
          panic: reflect.Set: value of type *event.Query is not assignable to type event.Query
   而且Readme里的文档 是用interface{}, 不是结构体。
   测试无论是序列化反序列化 比Go标准库的json 的时间都不如
       


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [I] [Golang] unmarshal to struct [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #1359:
URL: https://github.com/apache/fory/issues/1359#issuecomment-3743797635

   @longbai 另外你说的 interface的问题在当前的版本并不存在了:
   
   https://fory.apache.org/docs/next/guide/go/basic_serialization
   
   ```go
   // Serialize any value
   data, err := f.Serialize(value)
   if err != nil {
       // Handle error
   }
   
   // Deserialize into target
   var result MyType
   err = f.Deserialize(data, &result)
   if err != nil {
       // Handle error
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [Golang] unmarshal to struct [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed issue #1359: [Golang] unmarshal to struct
URL: https://github.com/apache/fory/issues/1359


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [Golang] unmarshal to struct [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #1359:
URL: https://github.com/apache/fory/issues/1359#issuecomment-3743809554

   > > Hi [@Nyx2022](https://github.com/Nyx2022), thanks for reporting this issue. Could you provide some test code here?嗨,感谢您报告此问题。你能在这里提供一些测试代码吗? Fury supports deserialized to struct directly:Fury 支持直接反序列化为 struct:
   > 	}
   > but the error occured : ![image](https://github.com/apache/incubator-fury/assets/51039208/447f42a6-d768-42a4-adf6-3c549b0b433a)
   > 
   > so how can i use fury in multi langs
   
   @Nyx2022 You can take https://fory.apache.org/docs/next/guide/go/cross_language and https://fory.apache.org/docs/next/guide/xlang/getting_started as references
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [Golang] unmarshal to struct [incubator-fury]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #1359:
URL: https://github.com/apache/incubator-fury/issues/1359#issuecomment-1922769770

   Hi @Nyx2022, thanks for reporting this issue. Could you provide some test code here?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [I] [Golang] unmarshal to struct [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #1359:
URL: https://github.com/apache/fory/issues/1359#issuecomment-3742345545

   @longbai 可以再重新试一下,新版本的 fory go 性能比 Protobuf 快2倍,比 msgpack 快11 倍
   
   Benchmark results on Apple M1 Pro:
   
   | Data Type    | Operation   | Fory (ops/s) | Protobuf (ops/s) | Msgpack (ops/s) | Fory vs PB | Fory vs MP |
   | ------------ | ----------- | ------------ | ---------------- | --------------- | ---------- | ---------- |
   | Struct       | Serialize   | 23.52M       | 10.83M           | 5.19M           | 2.17x      | 4.54x      |
   | Struct       | Deserialize | 15.01M       | 11.97M           | 3.28M           | 1.25x      | 4.58x      |
   | Sample       | Serialize   | 8.26M        | 3.01M            | 750K            | 2.75x      | 11.01x     |
   | Sample       | Deserialize | 4.52M        | 2.51M            | 387K            | 1.80x      | 11.70x     |
   | Mediacontent | Serialize   | 4.93M        | 2.30M            | 1.17M           | 2.14x      | 4.21x      |
   | Mediacontent | Deserialize | 2.74M        | 1.87M            | 751K            | 1.46x      | 3.65x      |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org