Skip to content

Commit

Permalink
[mssql] Rename DefaultDialect to MSSQLDialect
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie committed May 1, 2024
1 parent 0d13520 commit 0b50c16
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion clients/mssql/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (s *Store) Label() constants.DestinationKind {
}

func (s *Store) Dialect() sql.Dialect {
return sql.DefaultDialect{}
return sql.MSSQLDialect{}
}

func (s *Store) Merge(tableData *optimization.TableData) error {
Expand Down
2 changes: 1 addition & 1 deletion clients/mssql/tableid.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/artie-labs/transfer/lib/sql"
)

var dialect = sql.DefaultDialect{}
var dialect = sql.MSSQLDialect{}

type TableIdentifier struct {
schema string
Expand Down
4 changes: 2 additions & 2 deletions lib/destination/dml/merge_mssql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func Test_GetMSSQLStatement(t *testing.T) {
TableID: MockTableIdentifier{fqTable},
SubQuery: subQuery,
IdempotentKey: "",
PrimaryKeys: []columns.Wrapper{columns.NewWrapper(columns.NewColumn("id", typing.Invalid), sql.DefaultDialect{})},
PrimaryKeys: []columns.Wrapper{columns.NewWrapper(columns.NewColumn("id", typing.Invalid), sql.MSSQLDialect{})},
Columns: &_cols,
DestKind: constants.MSSQL,
Dialect: sql.DefaultDialect{},
Dialect: sql.MSSQLDialect{},
SoftDelete: false,
}

Expand Down
4 changes: 2 additions & 2 deletions lib/destination/dml/merge_parts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ func getBasicColumnsForTest(compositeKey bool) result {
cols.AddColumn(columns.NewColumn(constants.DeleteColumnMarker, typing.Boolean))

var pks []columns.Wrapper
pks = append(pks, columns.NewWrapper(idCol, sql.DefaultDialect{}))
pks = append(pks, columns.NewWrapper(idCol, sql.MSSQLDialect{}))

if compositeKey {
pks = append(pks, columns.NewWrapper(emailCol, sql.DefaultDialect{}))
pks = append(pks, columns.NewWrapper(emailCol, sql.MSSQLDialect{}))
}

return result{
Expand Down
6 changes: 3 additions & 3 deletions lib/sql/dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ type Dialect interface {
QuoteIdentifier(identifier string) string
}

type DefaultDialect struct{}
type MSSQLDialect struct{}

func (DefaultDialect) NeedsEscaping(_ string) bool { return true }
func (MSSQLDialect) NeedsEscaping(_ string) bool { return true }

func (DefaultDialect) QuoteIdentifier(identifier string) string {
func (MSSQLDialect) QuoteIdentifier(identifier string) string {
return fmt.Sprintf(`"%s"`, identifier)
}

Expand Down
2 changes: 1 addition & 1 deletion lib/sql/dialect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestDefaultDialect_QuoteIdentifier(t *testing.T) {
dialect := DefaultDialect{}
dialect := MSSQLDialect{}
assert.Equal(t, `"foo"`, dialect.QuoteIdentifier("foo"))
assert.Equal(t, `"FOO"`, dialect.QuoteIdentifier("FOO"))
}
Expand Down

0 comments on commit 0b50c16

Please sign in to comment.