refactor: update column field names in ExtractionQuery struct; enhance logging in consume and process methods
This commit is contained in:
@@ -182,10 +182,10 @@ func (mw *mssqlDbWrapper) QueryFromObject(ctx context.Context, q ExtractionQuery
|
||||
|
||||
sbQuery.WriteString("SELECT ")
|
||||
|
||||
if len(q.columns) == 0 {
|
||||
if len(q.Columns) == 0 {
|
||||
sbQuery.WriteString("*")
|
||||
} else {
|
||||
for i, col := range q.columns {
|
||||
for i, col := range q.Columns {
|
||||
fmt.Fprintf(&sbQuery, "[%s]", col.Name())
|
||||
|
||||
switch col.Type() {
|
||||
@@ -193,7 +193,7 @@ func (mw *mssqlDbWrapper) QueryFromObject(ctx context.Context, q ExtractionQuery
|
||||
fmt.Fprintf(&sbQuery, ".STAsBinary() AS [%s]", col.Name())
|
||||
}
|
||||
|
||||
if i < len(q.columns)-1 {
|
||||
if i < len(q.Columns)-1 {
|
||||
sbQuery.WriteString(", ")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,10 +135,10 @@ func (pw *postgresDbWrapper) QueryFromObject(ctx context.Context, q ExtractionQu
|
||||
|
||||
sbQuery.WriteString("SELECT ")
|
||||
|
||||
if len(q.columns) == 0 {
|
||||
if len(q.Columns) == 0 {
|
||||
sbQuery.WriteString("*")
|
||||
} else {
|
||||
for i, col := range q.columns {
|
||||
for i, col := range q.Columns {
|
||||
switch col.Type() {
|
||||
case "GEOMETRY":
|
||||
fmt.Fprintf(&sbQuery, `ST_AsEWKB("%s") AS "%s"`, col.Name(), col.Name())
|
||||
@@ -146,7 +146,7 @@ func (pw *postgresDbWrapper) QueryFromObject(ctx context.Context, q ExtractionQu
|
||||
fmt.Fprintf(&sbQuery, `"%s"`, col.Name())
|
||||
}
|
||||
|
||||
if i < len(q.columns)-1 {
|
||||
if i < len(q.Columns)-1 {
|
||||
sbQuery.WriteString(", ")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ type ExtractionQuery struct {
|
||||
Schema string
|
||||
Table string
|
||||
PrimaryKey string
|
||||
columns []models.ColumnType
|
||||
Columns []models.ColumnType
|
||||
LowerLimit ExtractorQueryLimit
|
||||
UpperLimit ExtractorQueryLimit
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user