Closed saulortega closed 6 years ago
https://github.com/volatiletech/sqlboiler/blob/d7d6aa4c3ab274f606830afeabde5709aa566c35/boilingcore/templates.go#L273 https://github.com/volatiletech/sqlboiler/blob/d7d6aa4c3ab274f606830afeabde5709aa566c35/strmangle/sets.go#L3-L4
Example usage:
{{$hasDeletedAt := setInclude "deleted_at" (columnNames .Table.Columns)}}
I think this should work for your use case. Re-open if insufficient.
Nice. :)
Thank you.
Because the created_at, updated_at and deleted_at columns can be considered "special" columns, they are useful for some custom template actions.
So, it would be good if there were variables that indicate if these columns exist. That way, I can create templates like:
That, considering the limitations of the template logic: I can not redefine a variable (unless I use a function)