Skip to content

Commit

Permalink
internal refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Jan 15, 2025
1 parent 21035c5 commit 5047bea
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions internal/xsql/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (e Engine) String() string {
switch e {
case LEGACY:
return "LEGACY"
case QUERY_SERVICE:
return "QUERY_SERVICE"
case PROPOSE:
return "PROPOSE"
default:
return "UNKNOWN"
}
Expand Down Expand Up @@ -116,8 +116,8 @@ func (c *Connector) Scheme() scheme.Client {
}

const (
QUERY_SERVICE = iota + 1 //nolint:revive,stylecheck
LEGACY //nolint:revive,stylecheck
PROPOSE = iota + 1
LEGACY
)

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

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

conn := &Conn{
processor: QUERY_SERVICE,
processor: PROPOSE,
cc: propose.New(ctx, c, s, append(
c.Options,
propose.WithOnClose(func() {
Expand Down Expand Up @@ -218,7 +218,7 @@ func Open(parent ydbDriver, balancer grpc.ClientConnInterface, opts ...Option) (
balancer: balancer,
processor: func() Engine {
if overQueryService, _ := strconv.ParseBool(os.Getenv("YDB_DATABASE_SQL_OVER_QUERY_SERVICE")); overQueryService {
return QUERY_SERVICE
return PROPOSE
}

return LEGACY
Expand Down
2 changes: 1 addition & 1 deletion internal/xsql/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func WithQueryOptions(opts ...propose.Option) Option {

func WithQueryService(b bool) Option {
if b {
return queryProcessorOption(QUERY_SERVICE)
return queryProcessorOption(PROPOSE)
}

return queryProcessorOption(LEGACY)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/database_sql_regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
switch driverEngine(db) {
case xsql.LEGACY:
require.Error(t, err)
case xsql.QUERY_SERVICE:
case xsql.PROPOSE:
require.NoError(t, err)
}
})
Expand Down Expand Up @@ -268,7 +268,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
require.NoError(t, err)
resUUID := uuid.UUID(res.AsBytesArray())
require.Equal(t, expectedResultWithBug, resUUID.String())
case xsql.QUERY_SERVICE:
case xsql.PROPOSE:
require.Error(t, err)
}
})
Expand Down Expand Up @@ -357,7 +357,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
require.NoError(t, err)
resUUID := uuid.UUID(resBytes.AsBytesArray())
require.Equal(t, id, resUUID)
case xsql.QUERY_SERVICE:
case xsql.PROPOSE:
require.Error(t, err)
}
})
Expand Down Expand Up @@ -425,7 +425,7 @@ func TestUUIDSerializationDatabaseSQLIssue1501(t *testing.T) {
resUUID := resFromDB.PublicRevertReorderForIssue1501()
resString := strings.ToUpper(resUUID.String())
require.Equal(t, idString, resString)
case xsql.QUERY_SERVICE:
case xsql.PROPOSE:
require.Error(t, err)
}
})
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/table_truncated_err_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestIssue798TruncatedError(t *testing.T) {
switch driverEngine(db) {
case xsql.LEGACY:
scope.Require.ErrorIs(err, result.ErrTruncated)
case xsql.QUERY_SERVICE:
case xsql.PROPOSE:
scope.Require.NoError(err)
}
}
Expand Down

0 comments on commit 5047bea

Please sign in to comment.