From f3c6bd34599966b9d3724d3eb7f0703cdf0383bd Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 3 Sep 2024 11:39:39 +0800 Subject: [PATCH] 1 --- godbpool.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/godbpool.go b/godbpool.go index 90827ae..09aa1bf 100644 --- a/godbpool.go +++ b/godbpool.go @@ -28,3 +28,27 @@ func (this *goDbPool) NewOrmSelect( }) return resultErr, resultDs } + + +func (this *goDbPool) NewUpsert( + dataSource string, + tblName string, + whereKv [][]string, + updateKv [][]string, + insertKv [][]string) (error, int64, int64) { + var resultErr error + var resultLastInsertId int64 + var resultRowsAffected int64 + this.Upsert( + dataSource, + tblName, + whereKv, + updateKv, + insertKv, + func (err error, lastInsertId int64, rowsAffected int64) { + resultErr = err + resultLastInsertId = lastInsertId + resultRowsAffected = rowsAffected + }) + return resultErr, resultLastInsertId, resultRowsAffected +}