arthurkushman / buildsqlx

Go database query builder library for PostgreSQL
MIT License
172 stars 17 forks source link

can't throw the error in Schema #66

Closed hzjux001 closed 2 years ago

hzjux001 commented 2 years ago

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 }

arthurkushman commented 2 years ago

https://github.com/arthurkushman/buildsqlx/releases/tag/v0.7.8