gitlab.com/evatix-go/core@v1.3.55/conditional/NilDefBool.go (about)

     1  package conditional
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  func NilDefBool(
     6  	valuePointer *bool,
     7  ) bool {
     8  	if valuePointer == nil {
     9  		return false
    10  	}
    11  
    12  	return *valuePointer
    13  }
    14  
    15  func NilDefBoolPtr(
    16  	valuePointer *bool,
    17  ) *bool {
    18  	if valuePointer == nil {
    19  		return constants.FalseBoolPtr
    20  	}
    21  
    22  	return valuePointer
    23  }
    24  
    25  func NilBoolVal(
    26  	valuePointer *bool,
    27  	defVal bool,
    28  ) bool {
    29  	if valuePointer == nil {
    30  		return defVal
    31  	}
    32  
    33  	return *valuePointer
    34  }
    35  
    36  func NilBoolValPtr(
    37  	valuePointer *bool,
    38  	defVal bool,
    39  ) *bool {
    40  	if valuePointer == nil {
    41  		return &defVal
    42  	}
    43  
    44  	return valuePointer
    45  }