Repository: zeromicro/go-zero
Pull request #3523 (2023-08-27 08:13:05)

Revert "add:func() QueryRowsPartial,QueryRowPartial into cachedsql.go"
Reverts zeromicro/go-zero#3512

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/zeromicro/go-zero/pull/3523?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#3523](https://app.codecov.io/gh/zeromicro/go-zero/pull/3523?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (36e7c99) into [master](https://app.codecov.io/gh/zeromicro/go-zero/commit/0423313d9bfd9d6102e5a2635bcf7fd78dd65449?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (0423313) will **increase** coverage by `0.01%`.
> Report is 1 commits behind head on master.
> The diff coverage is `n/a`.


[see 2 files with indirect coverage changes](https://app.codecov.io/gh/zeromicro/go-zero/pull/3523/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)


Patch:
diff --git a/core/stores/sqlc/cachedsql.go b/core/stores/sqlc/cachedsql.go
index addf3b40..8b81e925 100644
--- a/core/stores/sqlc/cachedsql.go
+++ b/core/stores/sqlc/cachedsql.go
@@ -190,17 +190,6 @@ func (cc CachedConn) QueryRowNoCacheCtx(ctx context.Context, v any, q string,
 	return cc.db.QueryRowCtx(ctx, v, q, args...)
 }
 
-// QueryRowPartialNoCache unmarshals into v with given statement.
-func (cc CachedConn) QueryRowPartialNoCache(v any, q string, args ...any) error {
-	return cc.QueryRowPartialNoCacheCtx(context.Background(), v, q, args...)
-}
-
-// QueryRowPartialNoCacheCtx unmarshals into v with given statement.
-func (cc CachedConn) QueryRowPartialNoCacheCtx(ctx context.Context, v any, q string,
-	args ...any) error {
-	return cc.db.QueryRowPartialCtx(ctx, v, q, args...)
-}
-
 // QueryRowsNoCache unmarshals into v with given statement.
 // It doesn't use cache, because it might cause consistency problem.
 func (cc CachedConn) QueryRowsNoCache(v any, q string, args ...any) error {
@@ -214,19 +203,6 @@ func (cc CachedConn) QueryRowsNoCacheCtx(ctx context.Context, v any, q string,
 	return cc.db.QueryRowsCtx(ctx, v, q, args...)
 }
 
-// QueryRowsPartialNoCache unmarshals into v with given statement.
-// It doesn't use cache, because it might cause consistency problem.
-func (cc CachedConn) QueryRowsPartialNoCache(v any, q string, args ...any) error {
-	return cc.QueryRowsPartialNoCacheCtx(context.Background(), v, q, args...)
-}
-
-// QueryRowsPartialNoCacheCtx unmarshals into v with given statement.
-// It doesn't use cache, because it might cause consistency problem.
-func (cc CachedConn) QueryRowsPartialNoCacheCtx(ctx context.Context, v any, q string,
-	args ...any) error {
-	return cc.db.QueryRowsPartialCtx(ctx, v, q, args...)
-}
-
 // SetCache sets v into cache with given key.
 func (cc CachedConn) SetCache(key string, val any) error {
 	return cc.SetCacheCtx(context.Background(), key, val)


Test patch:
diff --git a/core/stores/sqlc/cachedsql_test.go b/core/stores/sqlc/cachedsql_test.go
index 8bc1a6d5..c71ddcb5 100644
--- a/core/stores/sqlc/cachedsql_test.go
+++ b/core/stores/sqlc/cachedsql_test.go
@@ -16,6 +16,7 @@ import (
 	"time"
 
 	"github.com/DATA-DOG/go-sqlmock"
+	"github.com/alicebob/miniredis/v2"
 	"github.com/stretchr/testify/assert"
 	"github.com/zeromicro/go-zero/core/fx"
 	"github.com/zeromicro/go-zero/core/logx"
@@ -545,17 +546,6 @@ func TestCachedConnQueryRows(t *testing.T) {
 	assert.True(t, conn.queryRowsValue)
 }
 
-func TestCachedConnQueryRowsPartial(t *testing.T) {
-	r := redistest.CreateRedis(t)
-
-	var conn trackedConn
-	c := NewNodeConn(&conn, r, cache.WithExpiry(time.Second*10))
-	var users []string
-	err := c.QueryRowsPartialNoCache(&users, "select user from user_table where id='kevin'")
-	assert.Nil(t, err)
-	assert.True(t, conn.queryRowsValue)
-}
-
 func TestCachedConnTransact(t *testing.T) {
 	r := redistest.CreateRedis(t)
 
@@ -589,27 +579,6 @@ func TestQueryRowNoCache(t *testing.T) {
 	assert.True(t, ran)
 }
 
-func TestQueryRowPartialNoCache(t *testing.T) {
-	r := redistest.CreateRedis(t)
-
-	const (
-		key   = "user"
-		value = "any"
-	)
-	var user string
-	var ran bool
-	conn := dummySqlConn{queryRow: func(v any, q string, args ...any) error {
-		user = value
-		ran = true
-		return nil
-	}}
-	c := NewNodeConn(&conn, r, cache.WithExpiry(time.Second*30))
-	err := c.QueryRowPartialNoCache(&user, key)
-	assert.Nil(t, err)
-	assert.Equal(t, value, user)
-	assert.True(t, ran)
-}
-
 func TestNewConnWithCache(t *testing.T) {
 	r := redistest.CreateRedis(t)