fix(goctl)/new parser (#3834)

Co-authored-by: keson <keson@kesondeMacBook-Pro.local>
This commit is contained in:
kesonan
2024-01-11 23:50:53 +08:00
committed by GitHub
parent ffd2a78623
commit 7ba8adfc74
8 changed files with 171 additions and 5 deletions

View File

@@ -192,7 +192,10 @@ func Test_genPublicModel(t *testing.T) {
code, err := g.genModelCustom(*tables[0], false)
assert.NoError(t, err)
assert.True(t, strings.Contains(code, "package model"))
assert.True(t, strings.Contains(code, "TestUserModel interface {\n\t\ttestUserModel\n\t}\n"))
assert.True(t, strings.Contains(code, ` TestUserModel interface {
testUserModel
withSession(session sqlx.Session) TestUserModel
}`))
assert.True(t, strings.Contains(code, "customTestUserModel struct {\n\t\t*defaultTestUserModel\n\t}\n"))
assert.True(t, strings.Contains(code, "func NewTestUserModel(conn sqlx.SqlConn) TestUserModel {"))
}