Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterGroup ¶
RegisterGroup associates group names with functions.
Types ¶
type ActorGate ¶
type ActorGate struct {
// contains filtered or unexported fields
}
ActorGate is a gate to check if a feature is open for an actor.
func NewActorGate ¶
NewActorGate initializes an ActorGate with a set of ids.
func (ActorGate) IsOpen ¶
IsOpen check if the gate is open for an feature and an actor. It uses the actor set to know whether the gate is open or not.
type BoolGate ¶
type BoolGate struct {
// contains filtered or unexported fields
}
BoolGate is a gate that's open when its value is true.
func NewBoolGate ¶
NewBoolGate initializes a new BoolGate with a value.
func (BoolGate) BoolValue ¶
BoolValue returns the boolean value This satisfies the BoolGateType interface.
type BoolGateType ¶
type BoolGateType interface {
BoolValue() bool
}
BoolGateType represents a gate that uses boolean values.
type GateKey ¶
type GateKey string
GateKey is the type for gate keys.
const ( // BoolGateKey is the key for a BoolGate BoolGateKey GateKey = "boolean" // ActorGateKey is the key for an ActorGate ActorGateKey GateKey = "actors" // GroupGateKey is the key for a GroupGateKey GroupGateKey GateKey = "groups" // PercentageOfActorsGateKey is the key for a PercentageOfActorsGate PercentageOfActorsGateKey GateKey = "percentage_of_actors" // PercentageOfTimeGateKey is the key for a PercentageOfTimeGate PercentageOfTimeGateKey GateKey = "percentage_of_time" )
type GroupGate ¶
type GroupGate struct {
// contains filtered or unexported fields
}
GroupGate is a gate that checks if an actor is in a group or not. It uses registered GroupFunc functions for those checks.
func NewGroupGate ¶
NewGroupGate initializes a GroupGate with a set of group names.
func (GroupGate) IsOpen ¶
IsOpen check if the gate is open for an feature and an actor. It uses the registered GroupFunc to know if the gate is open or not.
type IntGateType ¶
type IntGateType interface {
IntValue() int
}
IntGateType represents a gate that uses int values.
type PercentageOfActorsGate ¶
type PercentageOfActorsGate struct {
// contains filtered or unexported fields
}
PercentageOfActorsGate is a gate that's open only for a percentage of the actors checked. The percentage can be any value between 0 and 100.
func NewPercentageOfActorsGate ¶
func NewPercentageOfActorsGate(percentage int) PercentageOfActorsGate
NewPercentageOfActorsGate initializes a PercentageOfActorsGate gate with a given percentage.
func (PercentageOfActorsGate) IntValue ¶
func (g PercentageOfActorsGate) IntValue() int
IntValue returns the gate's percentage as an int. This satisfies the IntGateType interface.
func (PercentageOfActorsGate) IsOpen ¶
IsOpen check if the gate is open for an feature and an actor. It calculates the likeliness of being open by its percentage.
func (PercentageOfActorsGate) Key ¶
func (PercentageOfActorsGate) Key() GateKey
Key returns the GateKey for a PercentageOfActorsGate gate.
type PercentageOfTimeGate ¶
type PercentageOfTimeGate struct {
// contains filtered or unexported fields
}
PercentageOfTimeGate is a gate that's open only a percentage of times. The percentage can be any value between 0 and 100.
func NewPercentageOfTimeGate ¶
func NewPercentageOfTimeGate(percentage int) PercentageOfTimeGate
NewPercentageOfTimeGate initializes a PercentageOfTimeGate gate with a given percentage.
func (PercentageOfTimeGate) IntValue ¶
func (g PercentageOfTimeGate) IntValue() int
IntValue returns the gate's percentage as an int. This satisfies the IntGateType interface.
func (PercentageOfTimeGate) IsOpen ¶
IsOpen check if the gate is open for an feature and an actor. It calculates the likeliness of being open by its percentage.
func (PercentageOfTimeGate) Key ¶
func (PercentageOfTimeGate) Key() GateKey
Key returns the GateKey for a PercentageOfTimeGate gate.
type SetGateType ¶
type SetGateType interface {
SetValue() Set
}
SetGateType represents a gate that uses set values.