Open MaxThom opened 6 hours ago
I tried replacing my time.Time with models.CustomDateTime. Unmarshalling works, but the value look truncated.
This get written
2024-11-08 20:12:54.317842571 +0000 UTC
and this get read
1970-01-01 00:00:00.317842571 +0000 UTC
just the ns are there...
this is in the db
d'1970-01-01T00:00:00.354Z'
Moreover, except the create, I am using I am using the Query function. This is my hearbeat update query
UPDATE devices MERGE {status: {lastHearthbeat: $BEAT,online: $ON,},} WHERE spec.deviceId = "0xf86tlm";
Where BEAT is a time.Time
Describe the bug
SurrealDb: v1.5.4 SDK: v0.3.0
While upgrading to the new version of the sdk, I keep getting this error when umarshalling my Device struct
error listing devices from database: cbor: cannot unmarshal array into Go struct field connection.RPCResponse[[]github.com/surrealdb/surrealdb%2ego.QueryResult[[]github.com/maxthom/mir/pkgs/mir_models.Device]].result of type time.Time
I have two time.Time field in those structs:
Something I have notice, before, when creating the DeviceObject using Create, the timestamps where set to the zero value of time, and with the new sdk, they are set to NULL. It works unmarshalling when null, but not when set or zero value Before:
After:
I'm not exactly sure thats the issue. Do i need to upgrade to v2.0 of surreal? Do i need to use models.CustomDateTime instead of time.Time?
Steps to reproduce
Expected behaviour
Unmarshal properly
SurrealDB version
1.5.4
Contact Details
maxthomassin@hotmail.com
Is there an existing issue for this?
Code of Conduct