define more default values for opConfig CRD (#955)

This commit is contained in:
Felix Kunde
2020-05-04 16:23:21 +02:00
committed by GitHub
parent d52296c323
commit 76d43525f7
5 changed files with 39 additions and 31 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ type LogicalBackup struct {
LogicalBackupS3Endpoint string `name:"logical_backup_s3_endpoint" default:""`
LogicalBackupS3AccessKeyID string `name:"logical_backup_s3_access_key_id" default:""`
LogicalBackupS3SecretAccessKey string `name:"logical_backup_s3_secret_access_key" default:""`
LogicalBackupS3SSE string `name:"logical_backup_s3_sse" default:"AES256"`
LogicalBackupS3SSE string `name:"logical_backup_s3_sse" default:""`
}
// Operator options for connection pooler
+11 -3
View File
@@ -147,7 +147,7 @@ func Coalesce(val, defaultVal string) string {
return val
}
// Yeah, golang
// CoalesceInt32 works like coalesce but for *int32
func CoalesceInt32(val, defaultVal *int32) *int32 {
if val == nil {
return defaultVal
@@ -155,6 +155,14 @@ func CoalesceInt32(val, defaultVal *int32) *int32 {
return val
}
// CoalesceBool works like coalesce but for *bool
func CoalesceBool(val, defaultVal *bool) *bool {
if val == nil {
return defaultVal
}
return val
}
// Test if any of the values is nil
func testNil(values ...*int32) bool {
for _, v := range values {
@@ -166,8 +174,8 @@ func testNil(values ...*int32) bool {
return false
}
// Return maximum of two integers provided via pointers. If one value is not
// defined, return the other one. If both are not defined, result is also
// MaxInt32 : Return maximum of two integers provided via pointers. If one value
// is not defined, return the other one. If both are not defined, result is also
// undefined, caller needs to check for that.
func MaxInt32(a, b *int32) *int32 {
if testNil(a, b) {