Skip to content

struct/slice fields are not relations but json fields but get generated as relations #41

@Idane

Description

@Idane

GORM Playground Link

go-gorm/playground#842

Description

Fields with the gorm:"serializer:json" tag are incorrectly generated as relations instead of columns. The generator ignores the specified column:name tag and outputs .WithName("FieldName") (used for associations) instead of .WithColumn("db_name").

For example, JsonSlice is defined with column:json_slice, but the generated code produces field.Slice[string]{}.WithName("JsonSlice"). It should generate .WithColumn("json_slice") to correctly map to the serialized database column.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions