add SyncSelectCustomQuery

This commit is contained in:
殷勇 2023-09-26 16:26:04 +08:00
parent f79618418e
commit eb482c3b27

View File

@ -89,6 +89,31 @@ func (this *dbPool) SelectCustomQuery(dataSource string, sql string, cb QueryRes
this.internalQuery(dataSource, sql, params, cb)
}
func (this *dbPool) SyncSelectCustomQuery(dataSource string, sql string, cb QueryResultCb) {
chDone := make(chan bool)
params := []string{}
if this.style == GO_STYLE_DB {
go this.internalQuery(dataSource, sql, params,
func(err error, ds *DataSet) {
cb(err, ds)
chDone <- true
})
} else {
this.internalQuery(dataSource, sql, params,
func(err error, ds *DataSet) {
cb(err, ds)
chDone <- true
})
}
for {
select {
case <-chDone:
close(chDone)
return
}
}
}
func (this *dbPool) SelectLike(
dataSource string,
tblName string,