flags

package
v0.0.0-...-4db2772 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ErrFlagAlreadyExists = FlagError("toggles: Flag already exists") // nolint:errname
View Source
const ErrFlagNotFound = FlagError("toggles: Flag not found") // nolint:errname

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultFlagService

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

func (DefaultFlagService) Create

func (flagService DefaultFlagService) Create(f Flag) error

func (DefaultFlagService) Delete

func (flagService DefaultFlagService) Delete(name string) error

func (DefaultFlagService) Exists

func (flagService DefaultFlagService) Exists(key string) (bool, error)

func (DefaultFlagService) Get

func (flagService DefaultFlagService) Get(key string) (bool, error)

func (DefaultFlagService) List

func (flagService DefaultFlagService) List() ([]Flag, error)

func (DefaultFlagService) Update

func (flagService DefaultFlagService) Update(name string, value bool) error

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value bool   `json:"value"`
}

func ParseFlag

func ParseFlag(data any) (*Flag, error)

func (Flag) String

func (f Flag) String() string

func (Flag) ToPrettyString

func (f Flag) ToPrettyString() string

type FlagError

type FlagError string

////////// Errors //////////

func (FlagError) Error

func (e FlagError) Error() string

type FlagMongoRepository

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

func (FlagMongoRepository) Delete

func (repository FlagMongoRepository) Delete(name string) error

func (FlagMongoRepository) Exists

func (repository FlagMongoRepository) Exists(name string) (bool, error)

func (FlagMongoRepository) Get

func (repository FlagMongoRepository) Get(key string) (bool, error)

func (FlagMongoRepository) List

func (repository FlagMongoRepository) List() ([]Flag, error)

func (FlagMongoRepository) Set

func (repository FlagMongoRepository) Set(key string, value any) error

type FlagRepository

type FlagRepository interface {
	Get(key string) (bool, error)
	Exists(name string) (bool, error)
	Set(key string, value any) error
	List() ([]Flag, error)
	Delete(name string) error
}

func NewFlagMongoRepository

func NewFlagMongoRepository(host string, port uint) (FlagRepository, error)

type FlagService

type FlagService interface {
	Get(key string) (bool, error)
	Create(f Flag) error
	Update(name string, value bool) error
	Exists(key string) (bool, error)
	List() ([]Flag, error)
	Delete(name string) error
}

func NewFlagService

func NewFlagService(cacheClient storage.CacheClient, repository FlagRepository) FlagService

Jump to

Keyboard shortcuts

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