From 105bc8faf6f683b96d36e743d531ec25f2db434c Mon Sep 17 00:00:00 2001 From: anqiansong Date: Tue, 23 Aug 2022 14:21:00 +0800 Subject: [PATCH] Remove useless comments --- example/gorm/user_model.gen.go | 24 ------------------------ example/xorm/user_model.gen.go | 24 ------------------------ internal/gen/gorm/gorm_gen.tpl | 5 +++-- internal/gen/xorm/xorm_gen.tpl | 5 +++-- 4 files changed, 6 insertions(+), 52 deletions(-) diff --git a/example/gorm/user_model.gen.go b/example/gorm/user_model.gen.go index fe88929..dfc51c0 100644 --- a/example/gorm/user_model.gen.go +++ b/example/gorm/user_model.gen.go @@ -36,22 +36,16 @@ type FindOneWhereParameter struct { IdEqual uint64 } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOneByNameWhereParameter is a where parameter structure. type FindOneByNameWhereParameter struct { NameEqual string } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOneGroupByNameWhereParameter is a where parameter structure. type FindOneGroupByNameWhereParameter struct { NameEqual string } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOneGroupByNameHavingNameWhereParameter is a where parameter structure. type FindOneGroupByNameHavingNameWhereParameter struct { NameEqual string @@ -62,10 +56,6 @@ type FindOneGroupByNameHavingNameHavingParameter struct { NameEqual string } -// TableName returns the table name. it implemented by gorm.Tabler. - -// TableName returns the table name. it implemented by gorm.Tabler. - // FindLimitWhereParameter is a where parameter structure. type FindLimitWhereParameter struct { IdGT uint64 @@ -76,16 +66,12 @@ type FindLimitLimitParameter struct { Count int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindLimitOffsetLimitParameter is a limit parameter structure. type FindLimitOffsetLimitParameter struct { Count int Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupLimitOffsetWhereParameter is a where parameter structure. type FindGroupLimitOffsetWhereParameter struct { IdGT uint64 @@ -97,8 +83,6 @@ type FindGroupLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupHavingLimitOffsetWhereParameter is a where parameter structure. type FindGroupHavingLimitOffsetWhereParameter struct { IdGT uint64 @@ -115,8 +99,6 @@ type FindGroupHavingLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupHavingOrderAscLimitOffsetWhereParameter is a where parameter structure. type FindGroupHavingOrderAscLimitOffsetWhereParameter struct { IdGT uint64 @@ -133,8 +115,6 @@ type FindGroupHavingOrderAscLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupHavingOrderDescLimitOffsetWhereParameter is a where parameter structure. type FindGroupHavingOrderDescLimitOffsetWhereParameter struct { IdGT uint64 @@ -151,15 +131,11 @@ type FindGroupHavingOrderDescLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOnePartWhereParameter is a where parameter structure. type FindOnePartWhereParameter struct { IdGT uint64 } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindAllCountResult is a find all count result. type FindAllCountResult struct { CountID sql.NullInt64 `gorm:"column:countID" json:"countID"` diff --git a/example/xorm/user_model.gen.go b/example/xorm/user_model.gen.go index 63d1692..b951382 100644 --- a/example/xorm/user_model.gen.go +++ b/example/xorm/user_model.gen.go @@ -36,22 +36,16 @@ type FindOneWhereParameter struct { IdEqual uint64 } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOneByNameWhereParameter is a where parameter structure. type FindOneByNameWhereParameter struct { NameEqual string } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOneGroupByNameWhereParameter is a where parameter structure. type FindOneGroupByNameWhereParameter struct { NameEqual string } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOneGroupByNameHavingNameWhereParameter is a where parameter structure. type FindOneGroupByNameHavingNameWhereParameter struct { NameEqual string @@ -62,10 +56,6 @@ type FindOneGroupByNameHavingNameHavingParameter struct { NameEqual string } -// TableName returns the table name. it implemented by gorm.Tabler. - -// TableName returns the table name. it implemented by gorm.Tabler. - // FindLimitWhereParameter is a where parameter structure. type FindLimitWhereParameter struct { IdGT uint64 @@ -76,16 +66,12 @@ type FindLimitLimitParameter struct { Count int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindLimitOffsetLimitParameter is a limit parameter structure. type FindLimitOffsetLimitParameter struct { Count int Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupLimitOffsetWhereParameter is a where parameter structure. type FindGroupLimitOffsetWhereParameter struct { IdGT uint64 @@ -97,8 +83,6 @@ type FindGroupLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupHavingLimitOffsetWhereParameter is a where parameter structure. type FindGroupHavingLimitOffsetWhereParameter struct { IdGT uint64 @@ -115,8 +99,6 @@ type FindGroupHavingLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupHavingOrderAscLimitOffsetWhereParameter is a where parameter structure. type FindGroupHavingOrderAscLimitOffsetWhereParameter struct { IdGT uint64 @@ -133,8 +115,6 @@ type FindGroupHavingOrderAscLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindGroupHavingOrderDescLimitOffsetWhereParameter is a where parameter structure. type FindGroupHavingOrderDescLimitOffsetWhereParameter struct { IdGT uint64 @@ -151,15 +131,11 @@ type FindGroupHavingOrderDescLimitOffsetLimitParameter struct { Offset int } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindOnePartWhereParameter is a where parameter structure. type FindOnePartWhereParameter struct { IdGT uint64 } -// TableName returns the table name. it implemented by gorm.Tabler. - // FindAllCountResult is a find all count result. type FindAllCountResult struct { CountID sql.NullInt64 `xorm:"'countID'" json:"countID"` diff --git a/internal/gen/gorm/gorm_gen.tpl b/internal/gen/gorm/gorm_gen.tpl index a49bb4e..f2ff6e7 100644 --- a/internal/gen/gorm/gorm_gen.tpl +++ b/internal/gen/gorm/gorm_gen.tpl @@ -25,8 +25,9 @@ type {{UpperCamel $.Table.Name}} struct { {{range $.Table.Columns}} {{end}}{{if $stmt.Having.IsValid}}{{$stmt.Having.ParameterStructure "Having"}} {{end}}{{if $stmt.Limit.Multiple}}{{$stmt.Limit.ParameterStructure}} {{end}}{{$stmt.ReceiverStructure "gorm"}} -// TableName returns the table name. it implemented by gorm.Tabler. -{{if IsExtraResult $stmt.ReceiverName}}func ({{$stmt.ReceiverName}}) TableName() string { + +{{if IsExtraResult $stmt.ReceiverName}}// TableName returns the table name. it implemented by gorm.Tabler. +func ({{$stmt.ReceiverName}}) TableName() string { return "{{$.Table.Name}}" }{{end}} {{end}} diff --git a/internal/gen/xorm/xorm_gen.tpl b/internal/gen/xorm/xorm_gen.tpl index a2bea0b..3864e48 100644 --- a/internal/gen/xorm/xorm_gen.tpl +++ b/internal/gen/xorm/xorm_gen.tpl @@ -26,8 +26,9 @@ type {{UpperCamel $.Table.Name}} struct { {{range $.Table.Columns}} {{end}}{{if $stmt.Having.IsValid}}{{$stmt.Having.ParameterStructure "Having"}} {{end}}{{if $stmt.Limit.Multiple}}{{$stmt.Limit.ParameterStructure}} {{end}}{{$stmt.ReceiverStructure "xorm"}} -// TableName returns the table name. it implemented by gorm.Tabler. -{{if IsExtraResult $stmt.ReceiverName}}func ({{$stmt.ReceiverName}}) TableName() string { + +{{if IsExtraResult $stmt.ReceiverName}}// TableName returns the table name. it implemented by gorm.Tabler. +func ({{$stmt.ReceiverName}}) TableName() string { return "{{$.Table.Name}}" }{{end}} {{end}}