refactor(wip): fix deepsource analyze
This commit is contained in:
parent
915cdb94bc
commit
7abf5669e4
@ -318,7 +318,7 @@ func (o *ormBase) LoadRelated(md interface{}, name string, args ...utils.KV) (in
|
|||||||
return o.LoadRelatedWithCtx(context.Background(), md, name, args...)
|
return o.LoadRelatedWithCtx(context.Background(), md, name, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ormBase) LoadRelatedWithCtx(ctx context.Context, md interface{}, name string, args ...utils.KV) (int64, error) {
|
func (o *ormBase) LoadRelatedWithCtx(_ context.Context, md interface{}, name string, args ...utils.KV) (int64, error) {
|
||||||
_, fi, ind, qs := o.queryRelated(md, name)
|
_, fi, ind, qs := o.queryRelated(md, name)
|
||||||
|
|
||||||
var relDepth int
|
var relDepth int
|
||||||
@ -488,7 +488,7 @@ func (o *ormBase) Raw(query string, args ...interface{}) RawSeter {
|
|||||||
return o.RawWithCtx(context.Background(), query, args...)
|
return o.RawWithCtx(context.Background(), query, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ormBase) RawWithCtx(ctx context.Context, query string, args ...interface{}) RawSeter {
|
func (o *ormBase) RawWithCtx(_ context.Context, query string, args ...interface{}) RawSeter {
|
||||||
return newRawSet(o, query, args)
|
return newRawSet(o, query, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -144,7 +144,7 @@ func getCaller(skip int) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func formatLines(s string) string {
|
func formatLines(s string) string {
|
||||||
return strings.Replace(s, "\t", " ", -1)
|
return strings.ReplaceAll(s, "\t", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Using stretchr/testify/assert
|
// Deprecated: Using stretchr/testify/assert
|
||||||
@ -1725,7 +1725,7 @@ func TestQueryM2M(t *testing.T) {
|
|||||||
throwFailNow(t, AssertIs(num, 1))
|
throwFailNow(t, AssertIs(num, 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQueryRelate(t *testing.T) {
|
func TestQueryRelate(_ *testing.T) {
|
||||||
// post := &Post{Id: 2}
|
// post := &Post{Id: 2}
|
||||||
|
|
||||||
// qs := dORM.QueryRelate(post, "Tags")
|
// qs := dORM.QueryRelate(post, "Tags")
|
||||||
@ -2075,9 +2075,7 @@ func TestRawPrepare(t *testing.T) {
|
|||||||
err error
|
err error
|
||||||
pre RawPreparer
|
pre RawPreparer
|
||||||
)
|
)
|
||||||
switch {
|
if IsMysql || IsSqlite {
|
||||||
case IsMysql || IsSqlite:
|
|
||||||
|
|
||||||
pre, err = dORM.Raw("INSERT INTO tag (name) VALUES (?)").Prepare()
|
pre, err = dORM.Raw("INSERT INTO tag (name) VALUES (?)").Prepare()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
if pre != nil {
|
if pre != nil {
|
||||||
@ -2112,9 +2110,7 @@ func TestRawPrepare(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, num, int64(3))
|
assert.Equal(t, num, int64(3))
|
||||||
}
|
}
|
||||||
|
} else if IsPostgres {
|
||||||
case IsPostgres:
|
|
||||||
|
|
||||||
pre, err = dORM.Raw(`INSERT INTO "tag" ("name") VALUES (?) RETURNING "id"`).Prepare()
|
pre, err = dORM.Raw(`INSERT INTO "tag" ("name") VALUES (?) RETURNING "id"`).Prepare()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
if pre != nil {
|
if pre != nil {
|
||||||
@ -2244,8 +2240,7 @@ func TestTransaction(t *testing.T) {
|
|||||||
throwFail(t, err)
|
throwFail(t, err)
|
||||||
throwFail(t, AssertIs(num, 1))
|
throwFail(t, AssertIs(num, 1))
|
||||||
|
|
||||||
switch {
|
if IsMysql || IsSqlite {
|
||||||
case IsMysql || IsSqlite:
|
|
||||||
res, err := to.Raw("INSERT INTO tag (name) VALUES (?)", names[2]).Exec()
|
res, err := to.Raw("INSERT INTO tag (name) VALUES (?)", names[2]).Exec()
|
||||||
throwFail(t, err)
|
throwFail(t, err)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user