Skip to content

Commit a1784b6

Browse files
committed
adding "BoolPtrToBoolValue" conv func
1 parent 3333bf9 commit a1784b6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

conv/values.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,16 @@ func BoolValueToBoolPtr(v attr.Value) *bool {
296296
return vPtr
297297
}
298298

299+
// BoolPtrToBoolValue accepts a bool pointer, returning a types.Bool with the dereferenced value.
300+
//
301+
// If the provided pointer is nil, the returned Bool type will be set as Null.
302+
func BoolPtrToBoolValue(b *bool) types.Bool {
303+
if b == nil {
304+
return types.BoolNull()
305+
}
306+
return types.BoolValue(*b)
307+
}
308+
299309
// NumberValueToBigFloat accepts either a types.Number or *types.Number, returning the raw *big.Float value. This may
300310
// be nil if the value was not set.
301311
func NumberValueToBigFloat(v attr.Value) *big.Float {

0 commit comments

Comments
 (0)