-
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.
- Loading branch information
1 parent
33f8a1d
commit 533e144
Showing
7 changed files
with
177 additions
and
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1 @@ | ||
package dml | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/artie-labs/transfer/lib/sql" | ||
"github.com/artie-labs/transfer/lib/typing" | ||
"github.com/artie-labs/transfer/lib/typing/columns" | ||
) | ||
|
||
// buildColumnsUpdateFragment will parse the columns and then returns a list of strings like: cc.first_name=c.first_name,cc.last_name=c.last_name,cc.email=c.email | ||
// NOTE: This should only be used with valid columns. | ||
func buildColumnsUpdateFragment(columns []columns.Column, dialect sql.Dialect) string { | ||
var cols []string | ||
for _, column := range columns { | ||
colName := dialect.QuoteIdentifier(column.Name()) | ||
if column.ToastColumn { | ||
var colValue string | ||
if column.KindDetails == typing.Struct { | ||
colValue = dialect.BuildProcessToastStructColExpression(colName) | ||
} else { | ||
colValue = dialect.BuildProcessToastColExpression(colName) | ||
} | ||
cols = append(cols, fmt.Sprintf("%s= %s", colName, colValue)) | ||
} else { | ||
// This is to make it look like: objCol = cc.objCol | ||
cols = append(cols, fmt.Sprintf("%s=cc.%s", colName, colName)) | ||
} | ||
} | ||
|
||
return strings.Join(cols, ",") | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.