feat: add range configuration to job and update extractors for inclusive range handling
This commit is contained in:
@@ -29,6 +29,7 @@ func buildExtractQueryMssql(
|
||||
columns []models.ColumnType,
|
||||
includeRange bool,
|
||||
isMinInclusive bool,
|
||||
isMaxInclusive bool,
|
||||
) string {
|
||||
var sbQuery strings.Builder
|
||||
|
||||
@@ -60,7 +61,15 @@ func buildExtractQueryMssql(
|
||||
sbQuery.WriteString(" >")
|
||||
}
|
||||
|
||||
fmt.Fprintf(&sbQuery, " @min AND [%s] <= @max", tableInfo.PrimaryKey)
|
||||
sbQuery.WriteString(" @min AND ")
|
||||
fmt.Fprintf(&sbQuery, "[%s]", tableInfo.PrimaryKey)
|
||||
if isMaxInclusive {
|
||||
sbQuery.WriteString(" <=")
|
||||
} else {
|
||||
sbQuery.WriteString(" <")
|
||||
}
|
||||
|
||||
sbQuery.WriteString(" @max")
|
||||
}
|
||||
|
||||
fmt.Fprintf(&sbQuery, " ORDER BY [%s] ASC", tableInfo.PrimaryKey)
|
||||
@@ -105,7 +114,7 @@ func (mssqlEx *MssqlExtractor) Exec(
|
||||
indexPrimaryKey int,
|
||||
chBatchesOut chan<- models.Batch,
|
||||
) (int, error) {
|
||||
query := buildExtractQueryMssql(tableInfo, columns, partition.HasRange, partition.Range.IsMinInclusive)
|
||||
query := buildExtractQueryMssql(tableInfo, columns, partition.HasRange, partition.Range.IsMinInclusive, partition.Range.IsMaxInclusive)
|
||||
|
||||
var queryArgs []any
|
||||
if partition.HasRange {
|
||||
|
||||
Reference in New Issue
Block a user