helpers

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DELIMITER        string = "."
	REPLACE_TEMPLATE string = "{{ .Values | get \"%s\" \"%v\" }}"
)

Variables

View Source
var (
	BumpValues    = []string{"annotation", "label", "securitycontext", "affinity"}
	BumpTemlplate = `` /* 188-byte string literal not displayed */

)

Functions

func CopyMap

func CopyMap(m map[string]interface{}) map[string]interface{}

func DeepMergeMap

func DeepMergeMap(dst, src map[string]interface{}) error

func GenerateDiffieHellmanParams

func GenerateDiffieHellmanParams(opts ...DiffieHellmanOpt) (string, error)

func GeneratePassphrase

func GeneratePassphrase(opts ...PassphraseOpt) string

func Int

func Int(i int) *int

func OnlyLetters

func OnlyLetters(s string) bool

func RemoveDuplicates

func RemoveDuplicates[T comparable](sliceList []T) []T

RemoveDuplicates takes in a generic slice of values and returns the same slice with duplicates removed

func ReplaceRecursive

func ReplaceRecursive(input map[string]interface{}, keys []string, output map[string]interface{}, template string)

TODO(FMJdev): add bump stop values which act as base case so we do not template Kubernetes labels etc. Relying on recursion until we hit a primitive is highly error prone.

func SanitizeSlice

func SanitizeSlice(slice []string) []string

func SliceContains

func SliceContains[T comparable](s []T, e T) bool

SliceContains checks if an element is contained within a slice

func StrPtr

func StrPtr(s string) *string

func WithBits

func WithBits(bits int) func(cfg *DiffieHellmanConfig)

func WithCharSet

func WithCharSet(charset string) func(conf *PassphraseConfig)

func WithEncoding

func WithEncoding(encoding Encoding) func(cfg *DiffieHellmanConfig)

func WithLength

func WithLength(length int) func(conf *PassphraseConfig)

Types

type DiffieHellmanConfig

type DiffieHellmanConfig struct {
	Bits     int
	Encoding Encoding
}

type DiffieHellmanOpt

type DiffieHellmanOpt func(cfg *DiffieHellmanConfig)

type Encoding

type Encoding int
const (
	Base64 Encoding = iota + 1
	Raw
)

type PassphraseConfig

type PassphraseConfig struct {
	Length  int
	CharSet string
}

type PassphraseOpt

type PassphraseOpt func(conf *PassphraseConfig)

type Primitive

type Primitive interface {
	bool | string | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64 | complex64 | complex128
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL