Skip to content

Commit 5047bea

Browse files
committed
internal refactoring
1 parent 21035c5 commit 5047bea

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

internal/xsql/connector.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ func (e Engine) String() string {
6868
switch e {
6969
case LEGACY:
7070
return "LEGACY"
71-
case QUERY_SERVICE:
72-
return "QUERY_SERVICE"
71+
case PROPOSE:
72+
return "PROPOSE"
7373
default:
7474
return "UNKNOWN"
7575
}
@@ -116,8 +116,8 @@ func (c *Connector) Scheme() scheme.Client {
116116
}
117117

118118
const (
119-
QUERY_SERVICE = iota + 1 //nolint:revive,stylecheck
120-
LEGACY //nolint:revive,stylecheck
119+
PROPOSE = iota + 1
120+
LEGACY
121121
)
122122

123123
func (c *Connector) Open(name string) (driver.Conn, error) {
@@ -130,7 +130,7 @@ func (c *Connector) Connect(ctx context.Context) (_ driver.Conn, finalErr error)
130130
)
131131

132132
switch c.processor {
133-
case QUERY_SERVICE:
133+
case PROPOSE:
134134
s, err := query.CreateSession(ctx, c.Query())
135135
defer func() {
136136
onDone(s, finalErr)
@@ -142,7 +142,7 @@ func (c *Connector) Connect(ctx context.Context) (_ driver.Conn, finalErr error)
142142
id := uuid.New()
143143

144144
conn := &Conn{
145-
processor: QUERY_SERVICE,
145+
processor: PROPOSE,
146146
cc: propose.New(ctx, c, s, append(
147147
c.Options,
148148
propose.WithOnClose(func() {
@@ -218,7 +218,7 @@ func Open(parent ydbDriver, balancer grpc.ClientConnInterface, opts ...Option) (
218218
balancer: balancer,
219219
processor: func() Engine {
220220
if overQueryService, _ := strconv.ParseBool(os.Getenv("YDB_DATABASE_SQL_OVER_QUERY_SERVICE")); overQueryService {
221-
return QUERY_SERVICE
221+
return PROPOSE
222222
}
223223

224224
return LEGACY

internal/xsql/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func WithQueryOptions(opts ...propose.Option) Option {
200200

201201
func WithQueryService(b bool) Option {
202202
if b {
203-
return queryProcessorOption(QUERY_SERVICE)
203+
return queryProcessorOption(PROPOSE)
204204
}
205205

206206
return queryProcessorOption(LEGACY)

tests/integration/database_sql_regression_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
239239
switch driverEngine(db) {
240240
case xsql.LEGACY:
241241
require.Error(t, err)
242-
case xsql.QUERY_SERVICE:
242+
case xsql.PROPOSE:
243243
require.NoError(t, err)
244244
}
245245
})
@@ -268,7 +268,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
268268
require.NoError(t, err)
269269
resUUID := uuid.UUID(res.AsBytesArray())
270270
require.Equal(t, expectedResultWithBug, resUUID.String())
271-
case xsql.QUERY_SERVICE:
271+
case xsql.PROPOSE:
272272
require.Error(t, err)
273273
}
274274
})
@@ -357,7 +357,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
357357
require.NoError(t, err)
358358
resUUID := uuid.UUID(resBytes.AsBytesArray())
359359
require.Equal(t, id, resUUID)
360-
case xsql.QUERY_SERVICE:
360+
case xsql.PROPOSE:
361361
require.Error(t, err)
362362
}
363363
})
@@ -425,7 +425,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
425425
resUUID := resFromDB.PublicRevertReorderForIssue1501()
426426
resString := strings.ToUpper(resUUID.String())
427427
require.Equal(t, idString, resString)
428-
case xsql.QUERY_SERVICE:
428+
case xsql.PROPOSE:
429429
require.Error(t, err)
430430
}
431431
})

tests/integration/table_truncated_err_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func TestIssue798TruncatedError(t *testing.T) {
137137
switch driverEngine(db) {
138138
case xsql.LEGACY:
139139
scope.Require.ErrorIs(err, result.ErrTruncated)
140-
case xsql.QUERY_SERVICE:
140+
case xsql.PROPOSE:
141141
scope.Require.NoError(err)
142142
}
143143
}

0 commit comments

Comments
 (0)