features

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 0 Imported by: 3

README

features

Simple implementation of the flags feature.

Usage
import "github.com/bavix/features"

const (
    Dishing features.Flag = iota
    Washing
    Cooking
    Driving
)
//...
toggles := features.New(Dishing, Washing, Cooking)

toggles.Has(Cooking) // true
toggles.Has(Driving) // false

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag uint64

type Toggles

type Toggles uint64

func New

func New(flags ...Flag) Toggles

New creates a new Toggles instance with the specified flags set.

func (Toggles) Has

func (t Toggles) Has(flags ...Flag) bool

Has checks if all the specified flags are set in the Toggles instance. It returns true if all flags are present, otherwise false.

Jump to

Keyboard shortcuts

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