1+ // Copyright (c) HashiCorp, Inc.
2+ // SPDX-License-Identifier: MPL-2.0
3+
14package refinement
25
36import (
@@ -23,20 +26,56 @@ func (k Key) String() string {
2326}
2427
2528const (
26- KeyNullness = Key (1 )
27- KeyStringPrefix = Key (2 )
29+ // KeyNullness represents a refinement that specifies whether the final value will not be null.
30+ //
31+ // MAINTINAER NOTE: In practice, this refinement data will only contain "false", indicating the final value
32+ // cannot be null. If the refinement data was ever set to "true", that would indicate the final value will be null, in which
33+ // case the value is not unknown, it is known and should not have any refinement data.
34+ //
35+ // This refinement is relevant for all types except tftypes.DynamicPseudoType.
36+ KeyNullness = Key (1 )
37+
38+ // KeyStringPrefix represents a refinement that specifies a known prefix of a final string value.
39+ //
40+ // This refinement is only relevant for tftypes.String.
41+ KeyStringPrefix = Key (2 )
42+
43+ // KeyNumberLowerBound represents a refinement that specifies the lower bound of possible values for a final number value.
44+ // The refinement data contains a boolean which indicates whether the bound is inclusive.
45+ //
46+ // This refinement is only relevant for tftypes.Number.
2847 KeyNumberLowerBound = Key (3 )
48+
49+ // KeyNumberUpperBound represents a refinement that specifies the upper bound of possible values for a final number value.
50+ // The refinement data contains a boolean which indicates whether the bound is inclusive.
51+ //
52+ // This refinement is only relevant for tftypes.Number.
2953 KeyNumberUpperBound = Key (4 )
30- // KeyCollectionLengthLowerBound = Key(5)
31- // KeyCollectionLengthUpperBound = Key(6)
54+
55+ // KeyCollectionLengthLowerBound represents a refinement that specifies the lower bound of possible length for a final collection value.
56+ //
57+ // This refinement is only relevant for tftypes.List, tftypes.Set, and tftypes.Map.
58+ KeyCollectionLengthLowerBound = Key (5 )
59+
60+ // KeyCollectionLengthUpperBound represents a refinement that specifies the upper bound of possible length for a final collection value.
61+ //
62+ // This refinement is only relevant for tftypes.List, tftypes.Set, and tftypes.Map.
63+ KeyCollectionLengthUpperBound = Key (6 )
3264)
3365
66+ // TODO: docs
3467type Refinement interface {
68+ // Equal should return true if the Refinement is considered equivalent to the
69+ // Refinement passed as an argument.
3570 Equal (Refinement ) bool
71+
72+ // String should return a human-friendly version of the Refinement.
3673 String () string
74+
3775 unimplementable () // prevents external implementations, all refinements are defined in the Terraform/HCL type system go-cty.
3876}
3977
78+ // TODO: docs
4079type Refinements map [Key ]Refinement
4180
4281func (r Refinements ) Equal (o Refinements ) bool {
0 commit comments