We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go struct:
type Project struct { marshal.Basemodel `table:"projects"` ID string `json:"id,omitempty"` Name string `json:"name"` Icon string `json:"icon,omitempty"` Desc string `json:"desc"` Owner string `json:"owner"` Status int32 `json:"status"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` DeletedAt *time.Time `json:"deleted_at,omitempty"` }
Record in SurrealDB:
{ "desc": "description", "icon": "icon-focusly", "id": "projects:⟨a81e88fa-05a2-4e0a-90c6-5f3bceaea7d6⟩", "name": "focusly", "owner": "NONE", "status": 1 }
Error Log:
json: cannot unmarshal object into Go struct field Project.id of type string
Query project records:
queryRes, err := db.Query("SELECT * FROM projects", nil) if err != nil { journal.Logger.Error(err) return nil, err } // Other convert logic in here...... err = marshal.Unmarshal(queryResMap["result"], &ProjectItems) if err != nil { journal.Logger.Error(err) return nil, err }
Unmarshal json models.RecordID to string ID in Go struct.
surreal 2.0.1 for macOS on aarch64
george@betterde.com
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Go struct:
Record in SurrealDB:
Error Log:
Steps to reproduce
Query project records:
Expected behaviour
Unmarshal json models.RecordID to string ID in Go struct.
SurrealDB version
surreal 2.0.1 for macOS on aarch64
Contact Details
george@betterde.com
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: