Skip to content

Commit

Permalink
Add FunctionsForConstraint helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Oct 7, 2022
1 parent 7a695b6 commit fb17b61
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions schema/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ func FunctionsForVersion(v *version.Version) (map[string]schema.FuncSignature, e
// TODO return funcs_v0_12.Functions(ver) instead?
return nil, errors.New("no matching functions found")
}

func FunctionsForConstraint(vc version.Constraints) (map[string]schema.FuncSignature, error) {
for _, v := range terraformVersions {
if vc.Check(v) {
return FunctionsForVersion(v)
}
}

// TODO create error struct
return nil, errors.New("no matching functions found")
}

0 comments on commit fb17b61

Please sign in to comment.