here is my code:
res, err := sqlxdb.Schema(tablename, func(table *buildsqlx.Table) {
...
myerr:=myfun()
if myerr !=nil{
return myerr
}
}
if err!=nil{
dosomething.........
}
but i can‘t get myerr
and I see the code in Schema is
func (r DB) Schema(tblName string, fn func(table Table)) (res sql.Result, err error) {
tbl := &Table{tblName: tblName}
fn(tbl) // run fn with Table struct passed to collect columns to []*column slice
I think it may be
func (r DB) Schema(tblName string, fn func(table Table)) (res sql.Result, err error) {
tbl := &Table{tblName: tblName}
err:=fn(tbl) // run fn with Table struct passed to collect columns to []*column slice
if err !=nil{
return err
}
here is my code: res, err := sqlxdb.Schema(tablename, func(table *buildsqlx.Table) { ... myerr:=myfun() if myerr !=nil{ return myerr } } if err!=nil{ dosomething......... } but i can‘t get myerr
and I see the code in Schema is
func (r DB) Schema(tblName string, fn func(table Table)) (res sql.Result, err error) { tbl := &Table{tblName: tblName} fn(tbl) // run fn with Table struct passed to collect columns to []*column slice
I think it may be
func (r DB) Schema(tblName string, fn func(table Table)) (res sql.Result, err error) { tbl := &Table{tblName: tblName} err:=fn(tbl) // run fn with Table struct passed to collect columns to []*column slice if err !=nil{ return err }