File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -591,11 +591,11 @@ func (f *Field) SetFields(sf []*Field) {
591591}
592592
593593// ColumnName returns the SQL valid column name of the field.
594- // The struct tag `column ` of the field can be use to set the name, otherwise
594+ // The struct tag `kallax ` of the field can be use to set the name, otherwise
595595// is the field name converted to lower snake case.
596596// If the resultant name is a reserved keyword a _ will be prepended to the name.
597597func (f * Field ) ColumnName () string {
598- name := f .Tag .Get ("column" )
598+ name := strings . TrimSpace ( strings . Split ( f .Tag .Get ("kallax" ), "," )[ 0 ] )
599599 if name == "" {
600600 name = toLowerSnakeCase (f .Name )
601601 }
Original file line number Diff line number Diff line change @@ -85,9 +85,9 @@ func (s *FieldSuite) TestColumnName() {
8585 {"" , "FooBar" , "foo_bar" },
8686 {"" , "ID" , "id" },
8787 {"" , "References" , "_references" },
88- {`column :"foo"` , "Bar" , "foo" },
89- {`column :"References"` , "Bar" , "_References" },
90- {`column :"references"` , "Bar" , "_references" },
88+ {`kallax :"foo"` , "Bar" , "foo" },
89+ {`kallax :"References"` , "Bar" , "_References" },
90+ {`kallax :"references"` , "Bar" , "_references" },
9191 }
9292
9393 for _ , c := range cases {
You can’t perform that action at this time.
0 commit comments