Skip to content

Commit

Permalink
fix(dbutil): function DBValueType support TIDB
Browse files Browse the repository at this point in the history
  • Loading branch information
lianxmfor committed Feb 14, 2022
1 parent 6d3f249 commit bb2c813
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions internal/database/dbutil/db_opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import (
"fmt"
"strings"

"cloud.google.com/go/bigquery"
"github.com/gocql/gocql"

"github.com/oom-ai/oomstore/pkg/errdefs"
"github.com/jmoiron/sqlx"
"github.com/spf13/cast"

"cloud.google.com/go/bigquery"
"github.com/jmoiron/sqlx"
"github.com/oom-ai/oomstore/pkg/errdefs"
"github.com/oom-ai/oomstore/pkg/oomstore/types"
)

Expand All @@ -38,8 +37,7 @@ func (d *DBOpt) ExecContext(ctx context.Context, query string, args []interface{
_, err := d.BigQueryDB.Query(query).Read(ctx)
return errdefs.WithStack(err)
case types.BackendCassandra:
err := d.CassandraDB.Query(query).Exec()
return errdefs.WithStack(err)
return errdefs.WithStack(d.CassandraDB.Query(query).Exec())
default:
_, err := d.SqlxDB.ExecContext(ctx, d.SqlxDB.Rebind(query), args...)
return errdefs.WithStack(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/database/dbutil/type_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func DBValueType(backend types.BackendType, valueType types.ValueType) (string,
mp = valueTypeToPostgresType
case types.BackendSQLite:
mp = valueTypeToSQLiteType
case types.BackendMySQL:
case types.BackendMySQL, types.BackendTiDB:
mp = valueTypeToMySQLType
case types.BackendCassandra:
mp = valueTypeToCassandraType
Expand Down

0 comments on commit bb2c813

Please sign in to comment.