Skip to content

Conversation

WqyJh
Copy link

@WqyJh WqyJh commented Jul 18, 2025

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Implement #1349

User Case Description

定义以下接口:

type TestSkipImpl interface {
	// gen:skip
	SkipMethod(id int) (gen.T, error)

	// NoSkipMethod
	// select * from users where id=@id
	NoSkipMethod(id int) (gen.T, error)
}

在生成的接口中会包含两个接口函数

type IUserDo interface {
	// ......
	SkipMethod(id int) (result model.User, err error)
	NoSkipMethod(id int) (result model.User, err error)
}

但是只会生成一个实现函数

// NoSkipMethod
// select * from users where id=@id
func (u userDo) NoSkipMethod(id int) (result model.User, err error) {
	var params []interface{}

	var generateSQL strings.Builder
	params = append(params, id)
	generateSQL.WriteString("select * from users where id=? ")

	var executeSQL *gorm.DB
	executeSQL = u.UnderlyingDB().Raw(generateSQL.String(), params...).Take(&result) // ignore_security_alert
	err = executeSQL.Error

	return
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant