engines

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

README

GoDoc

engines

import "github.com/go-coldbrew/feature-flags/engines"

Index

Variables

var DisabledVariant = &Variant{
    Name:    "disabled",
    Enabled: false,
}

type Context

Context specifies the context in which a feature toggle should be considered to be enabled or not.

type Context struct {
    // UserId is the the id of the user.
    UserId string

    // SessionId is the id of the session.
    SessionId string

    // RemoteAddress is the IP address of the machine.
    RemoteAddress string

    // Environment is the environment this application is running in.
    Environment string

    // AppName is the application name.
    AppName string

    // Properties is a map of additional properties.
    Properties map[string]string
}

type FeatureFlag

type FeatureFlag interface {
    IsEnabled(name string, ctx Context) bool
    GetVariant(name string, ctx Context) *Variant
}

type Payload

type Payload struct {
    // Type is the type of the payload
    Type string `json:"type"`
    // Value is the value of the payload type
    Value string `json:"value"`
}

type Variant

type Variant struct {
    // Name is the value of the variant name.
    Name string `json:"name"`
    // Payload is the value of the variant payload
    Payload Payload `json:"payload"`
    // Enabled indicates whether the feature which is extend by this variant was enabled or not.
    Enabled bool `json:"enabled"`
}

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisabledVariant = &Variant{
	Name:    "disabled",
	Enabled: false,
}

Functions

This section is empty.

Types

type Context

type Context struct {
	// UserId is the the id of the user.
	UserId string

	// SessionId is the id of the session.
	SessionId string

	// RemoteAddress is the IP address of the machine.
	RemoteAddress string

	// Environment is the environment this application is running in.
	Environment string

	// AppName is the application name.
	AppName string

	// Properties is a map of additional properties.
	Properties map[string]string
}

Context specifies the context in which a feature toggle should be considered to be enabled or not.

type FeatureFlag

type FeatureFlag interface {
	IsEnabled(name string, ctx Context) bool
	GetVariant(name string, ctx Context) *Variant
}

type Payload

type Payload struct {
	// Type is the type of the payload
	Type string `json:"type"`
	// Value is the value of the payload type
	Value string `json:"value"`
}

type Variant

type Variant struct {
	// Name is the value of the variant name.
	Name string `json:"name"`
	// Payload is the value of the variant payload
	Payload Payload `json:"payload"`
	// Enabled indicates whether the feature which is extend by this variant was enabled or not.
	Enabled bool `json:"enabled"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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