From 342673874621b750292d70f33f16d6309c7495be Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 8 May 2014 20:11:43 +0800 Subject: [PATCH] doc bug fixed --- docs/QuickStart.md | 4 +++- docs/QuickStartCn.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/QuickStart.md b/docs/QuickStart.md index 6a7651e2..434e3f2d 100644 --- a/docs/QuickStart.md +++ b/docs/QuickStart.md @@ -139,7 +139,9 @@ Of course, you can implement IMapper to make custom naming strategy. It's idealized of using IMapper for all naming. But if table or column is not in rule, we need new method to archive. -`engine.Table()` can change the database table name for struct. The struct tag `xorm:"'table_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 not in confusion, ignore single quotes. +* 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 tag `xorm:"'table_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 not in confusion, ignore single quotes. ### 2.4.Column definition diff --git a/docs/QuickStartCn.md b/docs/QuickStartCn.md index 6421bfff..638bc50d 100644 --- a/docs/QuickStartCn.md +++ b/docs/QuickStartCn.md @@ -141,7 +141,7 @@ engine.SetColumnMapper(SnakeMapper{}) 如果所有的命名都是按照IMapper的映射来操作的,那当然是最理想的。但是如果碰到某个表名或者某个字段名跟映射规则不匹配时,我们就需要别的机制来改变。 -* 如果struct拥有`Tablename() string`的成员方法,那么此方法的返回值即是该struct默认对应的数据库表名。 +* 如果struct拥有`TableName() string`的成员方法,那么此方法的返回值即是该struct默认对应的数据库表名。 * 通过`engine.Table()`方法可以改变struct对应的数据库表的名称,通过sturct中field对应的Tag中使用`xorm:"'column_name'"`可以使该field对应的Column名称为指定名称。这里使用两个单引号将Column名称括起来是为了防止名称冲突,因为我们在Tag中还可以对这个Column进行更多的定义。如果名称不冲突的情况,单引号也可以不使用。