Skip to content

Commit

Permalink
templates: conditionally set created automatic column
Browse files Browse the repository at this point in the history
This change takes into account if the the created automatic column was
set by the user in the update operation. If set, it will set the one
provided by the user. If not set, it will set to the default
"created_at" value.
  • Loading branch information
Gorka Lerchundi committed May 22, 2024
1 parent dfe24b6 commit 97ddb8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/main/16_update.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (o *{{$alias.UpSingular}}) Update({{if .NoContext}}exec boil.Executor{{else
{{end}}
{{if not .NoAutoTimestamps}}
if !columns.IsWhitelist() {
wl = strmangle.SetComplement(wl, []string{"created_at"})
wl = strmangle.SetComplement(wl, []string{"{{or $.AutoColumns.Created "created_at"}}"})
}
{{end -}}
if len(wl) == 0 {
Expand Down

0 comments on commit 97ddb8e

Please sign in to comment.