-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nathan <[email protected]>
- Loading branch information
1 parent
c1c07c6
commit ff3851c
Showing
19 changed files
with
80 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,8 @@ | ||
package sql | ||
|
||
import ( | ||
"github.com/artie-labs/transfer/lib/config/constants" | ||
) | ||
|
||
func EscapeNameIfNecessary(name string, uppercaseEscNames bool, destKind constants.DestinationKind) string { | ||
// TODO: Switch all calls of [EscapeNameIfNecessary] to [EscapeNameIfNecessaryUsingDialect] and kill this. | ||
var dialect = dialectFor(destKind, uppercaseEscNames) | ||
|
||
if destKind != constants.S3 && dialect.NeedsEscaping(name) { | ||
return dialect.QuoteIdentifier(name) | ||
} | ||
return name | ||
} | ||
|
||
func EscapeNameIfNecessaryUsingDialect(name string, dialect Dialect) string { | ||
if dialect.NeedsEscaping(name) { | ||
return dialect.QuoteIdentifier(name) | ||
} | ||
return name | ||
} | ||
|
||
func dialectFor(destKind constants.DestinationKind, uppercaseEscNames bool) Dialect { | ||
switch destKind { | ||
case constants.BigQuery: | ||
return BigQueryDialect{} | ||
case constants.Snowflake: | ||
return SnowflakeDialect{UppercaseEscNames: uppercaseEscNames} | ||
case constants.Redshift: | ||
return RedshiftDialect{} | ||
default: | ||
return DefaultDialect{} | ||
} | ||
} |
Oops, something went wrong.