Skip to content

Commit

Permalink
add support for fallback type mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ZelvaMan committed Oct 22, 2023
1 parent 52b63dc commit 9c1fe77
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/preprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,16 @@ func getMapping(mappings *map[string]mapping, dbDataType string) (*mapping, erro
val, isFound := (*mappings)[dbDataType]

if !isFound {
return nil, fmt.Errorf("mapping for dbType '%s' not found", dbDataType)
fallbackVal, fallbackExists := (*mappings)["*"]

if !fallbackExists {
return nil, fmt.Errorf("mapping for dbType '%s' not found and fallback mapping * is not set ", dbDataType)

}

VerboseLog("Using falllback value %+v for type %s", fallbackVal, dbDataType)

return &fallbackVal, nil
}

return &val, nil
Expand Down

0 comments on commit 9c1fe77

Please sign in to comment.