Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mssql] Rename DefaultDialect to MSSQLDialect #533

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions lib/sql/dialect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/assert"
)

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