switches

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package switches provides new type that implements flag.Value interface -- Switches. It can be used for enabling/disabling controllers/webhooks in your controller manager.

Index

Constants

View Source
const (
	All = "*"
)

Variables

This section is empty.

Functions

func Disable

func Disable(name string) string

Disable prepends disablePrefix prefix to an item name

Types

type Switches

type Switches struct {
	// contains filtered or unexported fields
}

func Make

func Make(settings ...string) Switches

Make creates an instance of Switches Same as New but returns copy of a struct, not a pointer

func New

func New(settings ...string) *Switches

New creates an instance of Switches and returns the pointer to it

func (*Switches) Active

func (s *Switches) Active() sets.Set[string]

Active returns names of all active items

func (*Switches) All

func (s *Switches) All() sets.Set[string]

All returns names of all items set in settings

func (*Switches) AllEnabled

func (s *Switches) AllEnabled(names ...string) bool

AllEnabled checks whether all switches with the given names are enabled.

func (*Switches) AnyEnabled

func (s *Switches) AnyEnabled(names ...string) bool

AnyEnabled checks whether any switch of the given names is enabled.

func (*Switches) DisabledByDefault

func (s *Switches) DisabledByDefault() sets.Set[string]

DisabledByDefault returns names of all disabled items

func (*Switches) Enabled

func (s *Switches) Enabled(name string) bool

Enabled checks if item is enabled

func (*Switches) EnabledByDefault

func (s *Switches) EnabledByDefault() sets.Set[string]

EnabledByDefault returns names of all enabled items

func (*Switches) Set

func (s *Switches) Set(val string) error

func (*Switches) String

func (s *Switches) String() string

func (*Switches) Type

func (s *Switches) Type() string

func (*Switches) Values

func (s *Switches) Values() map[string]bool

Values returns the switches with their values.

Jump to

Keyboard shortcuts

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