Refactor code to use 'any' type and improve context handling
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -237,15 +237,15 @@ func copySQLiteTableIntoPostgres(ctx context.Context, source *sqlx.DB, destinati
|
||||
|
||||
var rowsCopied int64
|
||||
for rows.Next() {
|
||||
rawValues := make([]interface{}, len(columns))
|
||||
scanTargets := make([]interface{}, len(columns))
|
||||
rawValues := make([]any, len(columns))
|
||||
scanTargets := make([]any, len(columns))
|
||||
for i := range rawValues {
|
||||
scanTargets[i] = &rawValues[i]
|
||||
}
|
||||
if err := rows.Scan(scanTargets...); err != nil {
|
||||
return rowsCopied, fmt.Errorf("failed to scan row from sqlite table %q: %w", tableName, err)
|
||||
}
|
||||
args := make([]interface{}, len(columns))
|
||||
args := make([]any, len(columns))
|
||||
for i, col := range columns {
|
||||
args[i] = coerceSQLiteValueForPostgres(rawValues[i], col.DestinationType)
|
||||
}
|
||||
@@ -366,7 +366,7 @@ ORDER BY ordinal_position
|
||||
return nil
|
||||
}
|
||||
|
||||
func coerceSQLiteValueForPostgres(value interface{}, destinationType string) interface{} {
|
||||
func coerceSQLiteValueForPostgres(value any, destinationType string) any {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -385,7 +385,7 @@ func coerceSQLiteValueForPostgres(value interface{}, destinationType string) int
|
||||
return value
|
||||
}
|
||||
|
||||
func coerceBoolValue(value interface{}) (bool, bool) {
|
||||
func coerceBoolValue(value any) (bool, bool) {
|
||||
switch v := value.(type) {
|
||||
case bool:
|
||||
return v, true
|
||||
|
||||
Reference in New Issue
Block a user