Skip to content

Commit

Permalink
fix missing column issue
Browse files Browse the repository at this point in the history
  • Loading branch information
danielecook committed Jun 30, 2020
1 parent 251ebc2 commit 22683ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/validate/numbers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ func rangeFunc(args ...interface{}) (interface{}, error) {
}
var between bool
switch val := args[0].(type) {
case nil:
return (bool)(true), nil
case float64:
between = args[1].(float64) <= val && val <= args[2].(float64)
default:
return (bool)(false), nil
}
val := args[0].(float64)
between = args[1].(float64) <= val && val <= args[2].(float64)
Expand Down
7 changes: 7 additions & 0 deletions src/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ func RunValidation(schema schema.SchemaRules, input string) bool {

for idx, col := range schema.Columns {
colIndex := indexOf(col.Name, colnames)

// Check to see if column exists
if colIndex == -1 {
// TODO: Add error for missing column / make optional?
continue
}

// Add in current column
currentVar := parameters[col.Name]
parameters["current_var_"] = currentVar
Expand Down

0 comments on commit 22683ba

Please sign in to comment.