This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
generated from FrangipaneTeam/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbool_value.go
101 lines (80 loc) · 2.27 KB
/
bool_value.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// -------------------------------------------------------------------- //
// ! DO NOT EDIT. This file is auto-generated from template ! //
// -------------------------------------------------------------------- //
package supertypes
import (
"context"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
)
// Ensure the implementation satisfies the expected interfaces.
var _ basetypes.BoolValuable = BoolValue{}
type BoolValue struct {
basetypes.BoolValue
}
func (v BoolValue) Equal(o attr.Value) bool {
other, ok := o.(BoolValue)
if !ok {
return false
}
return v.BoolValue.Equal(other.BoolValue)
}
func (v BoolValue) Type(ctx context.Context) attr.Type {
return BoolType{
BoolType: v.BoolValue.Type(ctx).(basetypes.BoolType),
}
}
func NewBoolNull() BoolValue {
return BoolValue{
BoolValue: basetypes.NewBoolNull(),
}
}
func NewBoolUnknown() BoolValue {
return BoolValue{
BoolValue: basetypes.NewBoolUnknown(),
}
}
func NewBoolValue(s bool) BoolValue {
return BoolValue{
BoolValue: basetypes.NewBoolValue(s),
}
}
func NewBoolPointerValue(s *bool) BoolValue {
return BoolValue{
BoolValue: basetypes.NewBoolPointerValue(s),
}
}
// * CustomFunc
// Get returns the known Bool value. If Bool is null or unknown, returns false.
func (v *BoolValue) Get() bool {
return v.BoolValue.ValueBool()
}
// GetPtr returns a pointer to the known int64 value, nil for a
// null value, or a pointer to 0 for an unknown value.
func (v *BoolValue) GetPtr() *bool {
return v.BoolValue.ValueBoolPointer()
}
// Set sets the Bool value.
func (v *BoolValue) Set(s bool) {
v.BoolValue = basetypes.NewBoolValue(s)
}
// SetPtr sets a pointer to the Bool value.
func (v *BoolValue) SetPtr(s *bool) {
if s == nil {
v.BoolValue = basetypes.NewBoolNull()
return
}
v.BoolValue = basetypes.NewBoolPointerValue(s)
}
// SetNull sets the Bool value to null.
func (v *BoolValue) SetNull() {
v.BoolValue = basetypes.NewBoolNull()
}
// SetUnknown sets the Bool value to unknown.
func (v *BoolValue) SetUnknown() {
v.BoolValue = basetypes.NewBoolUnknown()
}
// IsKnown returns true if the value is not null and not unknown.
func (v BoolValue) IsKnown() bool {
return !v.BoolValue.IsNull() && !v.BoolValue.IsUnknown()
}