Hi, I’m trying to create an intermediate node between two nodes, which would look like this:
User - - - UserSport - - - Sport
Using the dgo client using this struct:
type UserSport struct {
UID string `json:"uid,omitempty"`
Sport []sport.Sport `json:"sport,omitempty"`
Default bool `json:"default,omitempty"`
Priority int `json:"priority,omitempty"`
}
type User struct {
UID string `form:"-" json:"uid,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Sports []UserSport `json:"sports,omitempty"`
}
type Sport struct {
SportID string `form:"uid" json:"uid,omitempty"`
Name string `form:"name" json:"name,omitempty"`
Description string `form:"description" json:"description,omitempty"`
}
I commit specifying this struct:
user := User{
UID: auth.GetUser(r.Context()),
Sports: sports, // sports list as []UserSport
}
, it results in this JSON:
{
"uid": "0x4",
"sports": [
{
"sport": [
{
"uid": "0x2"
}
],
"default": true
},
{
"sport": [
{
"uid": "0x8"
}
],
"priority": 1
},
{
"sport": [
{
"uid": "0x9"
}
],
"priority": 2
}
]
}
I get this error: Input for predicate sport of type scalar is uid
when mutating.
What am I doing wrong?