@@ -20,10 +20,14 @@ import (
2020
2121func Test_Table_Relation_With_Scan (t * testing.T ) {
2222 var (
23- tableUser = "user_" + gtime . TimestampNanoStr ()
24- tableUserDetail = "user_detail_" + gtime . TimestampNanoStr ()
25- tableUserScores = "user_score_" + gtime . TimestampNanoStr ()
23+ tableUser = "with_scan_user"
24+ tableUserDetail = "with_scan_user_detail"
25+ tableUserScores = "with_scan_user_score"
2626 )
27+ dropTable (tableUser )
28+ dropTable (tableUserDetail )
29+ dropTable (tableUserScores )
30+
2731 if _ , err := db .Exec (ctx , fmt .Sprintf (gtest .DataContent ("with_tpl_user.sql" ), tableUser )); err != nil {
2832 gtest .Error (err )
2933 }
@@ -40,20 +44,20 @@ func Test_Table_Relation_With_Scan(t *testing.T) {
4044 defer dropTable (tableUserScores )
4145
4246 type UserDetail struct {
43- gmeta.Meta `orm:"table:user_detail "`
47+ gmeta.Meta `orm:"table:with_scan_user_detail "`
4448 Uid int `json:"uid"`
4549 Address string `json:"address"`
4650 }
4751
4852 type UserScore struct {
49- gmeta.Meta `orm:"table:user_score "`
53+ gmeta.Meta `orm:"table:with_scan_user_score "`
5054 Id int `json:"id"`
5155 Uid int `json:"uid"`
5256 Score int `json:"score"`
5357 }
5458
5559 type User struct {
56- gmeta.Meta `orm:"table:user "`
60+ gmeta.Meta `orm:"table:with_scan_user "`
5761 Id int `json:"id"`
5862 Name string `json:"name"`
5963 UserDetail * UserDetail `orm:"with:uid=id"`
@@ -163,10 +167,14 @@ func Test_Table_Relation_With_Scan(t *testing.T) {
163167
164168func Test_Table_Relation_With (t * testing.T ) {
165169 var (
166- tableUser = "user_" + gtime . TimestampNanoStr ()
167- tableUserDetail = "user_detail_" + gtime . TimestampNanoStr ()
168- tableUserScores = "user_scores_" + gtime . TimestampNanoStr ()
170+ tableUser = "with_rel_user"
171+ tableUserDetail = "with_rel_user_detail"
172+ tableUserScores = "with_rel_user_scores"
169173 )
174+ dropTable (tableUser )
175+ dropTable (tableUserDetail )
176+ dropTable (tableUserScores )
177+
170178 if _ , err := db .Exec (ctx , fmt .Sprintf (gtest .DataContent ("with_tpl_user.sql" ), tableUser )); err != nil {
171179 gtest .Error (err )
172180 }
@@ -183,20 +191,20 @@ func Test_Table_Relation_With(t *testing.T) {
183191 defer dropTable (tableUserScores )
184192
185193 type UserDetail struct {
186- gmeta.Meta `orm:"table:user_detail "`
194+ gmeta.Meta `orm:"table:with_rel_user_detail "`
187195 Uid int `json:"uid"`
188196 Address string `json:"address"`
189197 }
190198
191199 type UserScores struct {
192- gmeta.Meta `orm:"table:user_scores "`
200+ gmeta.Meta `orm:"table:with_rel_user_scores "`
193201 Id int `json:"id"`
194202 Uid int `json:"uid"`
195203 Score int `json:"score"`
196204 }
197205
198206 type User struct {
199- gmeta.Meta `orm:"table:user "`
207+ gmeta.Meta `orm:"table:with_rel_user "`
200208 Id int `json:"id"`
201209 Name string `json:"name"`
202210 UserDetail * UserDetail `orm:"with:uid=id"`
0 commit comments