surrealdb / surrealdb.go

SurrealDB SDK for Golang
https://surrealdb.com
Apache License 2.0
232 stars 60 forks source link

Feature: Move and test `unmarshalMapToStruct(data map[string]interface{}, outStruct interface{})` #106

Open phughk opened 10 months ago

phughk commented 10 months ago

Is your feature request related to a problem?

A lot of the deserialisation is happening via JSON, even for code that is already deserialised. There is a non-json marshaller, unmarshalMapToStruct(data map[string]interface{}, outStruct interface{}), in gorilla.go. It should be moved to a separate package (not protocol implementation related, not API related) and tested.

Describe the solution

Move the function unmarshalMapToStruct(data map[string]interface{}, outStruct interface{}) into a separate package. Test the funciton independently of protocol implementations.

Alternative methods

There could already be code that does this. It's important that we don't rely on translating map[string]interface{} into json and back into a golang struct though.

SurrealDB version

1.0.0

Contact Details

pratim.bhosale@surrealdb.com hugh@surrealdb.com

Is there an existing issue for this?

Code of Conduct

ElecTwix commented 10 months ago

Hi @phughk , I can take this if it is still available.

phughk commented 10 months ago

Amazing thank you @ElecTwix !