diff options
Diffstat (limited to 'vendor/github.com/zclconf/go-cty/cty/function/argument.go')
-rw-r--r-- | vendor/github.com/zclconf/go-cty/cty/function/argument.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/vendor/github.com/zclconf/go-cty/cty/function/argument.go b/vendor/github.com/zclconf/go-cty/cty/function/argument.go new file mode 100644 index 0000000..bfd3015 --- /dev/null +++ b/vendor/github.com/zclconf/go-cty/cty/function/argument.go | |||
@@ -0,0 +1,50 @@ | |||
1 | package function | ||
2 | |||
3 | import ( | ||
4 | "github.com/zclconf/go-cty/cty" | ||
5 | ) | ||
6 | |||
7 | // Parameter represents a parameter to a function. | ||
8 | type Parameter struct { | ||
9 | // Name is an optional name for the argument. This package ignores this | ||
10 | // value, but callers may use it for documentation, etc. | ||
11 | Name string | ||
12 | |||
13 | // A type that any argument for this parameter must conform to. | ||
14 | // cty.DynamicPseudoType can be used, either at top-level or nested | ||
15 | // in a parameterized type, to indicate that any type should be | ||
16 | // permitted, to allow the definition of type-generic functions. | ||
17 | Type cty.Type | ||
18 | |||
19 | // If AllowNull is set then null values may be passed into this | ||
20 | // argument's slot in both the type-check function and the implementation | ||
21 | // function. If not set, such values are rejected by the built-in | ||
22 | // checking rules. | ||
23 | AllowNull bool | ||
24 | |||
25 | // If AllowUnknown is set then unknown values may be passed into this | ||
26 | // argument's slot in the implementation function. If not set, any | ||
27 | // unknown values will cause the function to immediately return | ||
28 | // an unkonwn value without calling the implementation function, thus | ||
29 | // freeing the function implementer from dealing with this case. | ||
30 | AllowUnknown bool | ||
31 | |||
32 | // If AllowDynamicType is set then DynamicVal may be passed into this | ||
33 | // argument's slot in the implementation function. If not set, any | ||
34 | // dynamic values will cause the function to immediately return | ||
35 | // DynamicVal value without calling the implementation function, thus | ||
36 | // freeing the function implementer from dealing with this case. | ||
37 | // | ||
38 | // Note that DynamicVal is also unknown, so in order to receive dynamic | ||
39 | // *values* it is also necessary to set AllowUnknown. | ||
40 | // | ||
41 | // However, it is valid to set AllowDynamicType without AllowUnknown, in | ||
42 | // which case a dynamic value may be passed to the type checking function | ||
43 | // but will not make it to the *implementation* function. Instead, an | ||
44 | // unknown value of the type returned by the type-check function will be | ||
45 | // returned. This is suggested for functions that have a static return | ||
46 | // type since it allows the return value to be typed even if the input | ||
47 | // values are not, thus improving the type-check accuracy of derived | ||
48 | // values. | ||
49 | AllowDynamicType bool | ||
50 | } | ||