4 ms·
Just a copy and paste from the solution I posted elsewhere... this really shouldn't be too hard to work around: You can easily make a wrapper type that simply
by NateDad 11y ago
Just a copy and paste from the solution I posted elsewhere... this really shouldn't be too hard to work around:
You can easily make a wrapper type that simply masks the underlying Next() method with its own implementation.
type MyType struct {}
func (m *MyType) Next(i int) {
// do base next stuff
}
type ForSql struct {
*MyType
}
func (f ForSql) Next() bool {
// do sql-next stuff
}
and then using this type is trivial in-code:
mt := &MyType{}
doSomeSqlThing(ForSql{mt})
Note that this new type retains all the methods of the original type, so it still implements all the interfaces it used to (unless they rely on the old Next signature).