Skip to content
New issue

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

Add serializer tag support #245

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions options/gorm.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,10 @@ func (b *ORMBuilder) renderGormTag(field *Field) string {
gormRes += "-;"
}

if len(tag.GetSerializer()) > 0 {
gormRes += fmt.Sprintf("serializer:%s;", tag.GetSerializer())
}

var foreignKey, associationForeignKey, joinTable, joinTableForeignKey, associationJoinTableForeignKey string
var associationAutoupdate, associationAutocreate, associationSaveReference, preload, replace, append, clear bool
if hasOne := field.GetHasOne(); hasOne != nil {
Expand Down
1 change: 1 addition & 0 deletions proto/options/gorm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ message GormTag {
bool association_autocreate = 21;
bool association_save_reference = 22;
bool preload = 23;
string serializer = 24;
}

message HasOneOptions {
Expand Down