You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/01/17 02:39:24 UTC
[incubator-devlake] branch release-v0.15 updated: feat: add `dal.RawCursor` back for compatibility (#4215)
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch release-v0.15
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.15 by this push:
new e9b4509d9 feat: add `dal.RawCursor` back for compatibility (#4215)
e9b4509d9 is described below
commit e9b4509d9778056d00130488ae1ab071c86456d9
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Tue Jan 17 10:39:21 2023 +0800
feat: add `dal.RawCursor` back for compatibility (#4215)
---
impl/dalgorm/dalgorm.go | 5 +++++
plugins/core/dal/dal.go | 2 ++
2 files changed, 7 insertions(+)
diff --git a/impl/dalgorm/dalgorm.go b/impl/dalgorm/dalgorm.go
index f09791ef4..a1a695c50 100644
--- a/impl/dalgorm/dalgorm.go
+++ b/impl/dalgorm/dalgorm.go
@@ -365,6 +365,11 @@ func (d *Dalgorm) IsDuplicationError(err errors.Error) bool {
return strings.Contains(strings.ToLower(err.Error()), "duplicate")
}
+// RawCursor (Deprecated) executes raw sql query and returns a database cursor
+func (d *Dalgorm) RawCursor(query string, params ...interface{}) (*sql.Rows, errors.Error) {
+ return errors.Convert01(d.db.Raw(query, params...).Rows())
+}
+
// NewDalgorm creates a *Dalgorm
func NewDalgorm(db *gorm.DB) *Dalgorm {
return &Dalgorm{db}
diff --git a/plugins/core/dal/dal.go b/plugins/core/dal/dal.go
index 90f546645..f72010ce2 100644
--- a/plugins/core/dal/dal.go
+++ b/plugins/core/dal/dal.go
@@ -144,6 +144,8 @@ type Dal interface {
IsErrorNotFound(err errors.Error) bool
// IsDuplicationError returns true if error is duplicate-error
IsDuplicationError(err errors.Error) bool
+ // RawCursor (Deprecated) executes raw sql query and returns a database cursor.
+ RawCursor(query string, params ...interface{}) (*sql.Rows, errors.Error)
}
type Transaction interface {