-
I have a struct like this type Relation struct {
SourceID mySQLTypes.ID `gorm:"type:varbinary(16);primaryKey,priority:1;index:src_id_and_type,priority:1"`
TargetID mySQLTypes.ID `gorm:"type:varbinary(16);primaryKey,priority:1;index:target_id_and_type,priority:1"`
SourceType string `gorm:"primaryKey,priority:2;index;index:src_id_and_type,priority:2" sql:"type:varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci"`
TargetType string `gorm:"primaryKey,priority:2;index;index:target_id_and_type,priority:2" sql:"type:varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci"`
} This is faulty, b/c none of the primary key is set in the table, let alone their priorities. |
Beta Was this translation helpful? Give feedback.
Answered by
JonasDoe
Nov 13, 2023
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
JonasDoe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, found it out myself:
After short debugging through the source code, it the whole
primaryKey
entry is not parsed correctly:So I figured I'ld might have to seperate these values with a semicolon, e.g.
gorm:"type:varbinary(16);primaryKey;priority:1;index:src_id_and_type,priority:1"
. That seemed to work!