551 B
551 B
2.3.Tag mapping
Using names.Mapper
for all naming is the best choice. But if table or column is not in rule, we need new method to archive.
-
If struct or pointer of struct has
TableName() string
method, the return value will be the struct's table name. -
engine.Table()
can change the database table name for struct. The struct tagxorm:"'column_name'"
can set column name for struct field. Use a pair of single quotes to prevent confusion for column's definition in struct tag. If there is no risk of confusion, ignore single quotes.