Skip to content

naoina/gocchan

Repository files navigation

Gocchan Build Status

FeatureToggle library for golang.

Gocchan is inspired by Chanko.

Installation

go get -u github.com/naoina/gocchan

Usage

Implement the Feature interface:

type MyFeature struct {}

func (f *MyFeature) ActiveIf(context interface{}, options ...interface{}) bool {
    return true
}

Define the function of Feature:

func (f *MyFeature) ExecMyFeature(context interface{}) {
    // do something.
}

Add Feature:

gocchan.AddFeature("name of feature", &MyFeature{})

Invoke:

gocchan.Invoke("context", "name of feature", "ExecMyFeature", func() {
    // default processes.
})

The function literal passed to 4th argument of the gocchan.Invoke is called when any errors occurred in method of Feature. And also when ActiveIf returns false is same as above.

See Godoc for more docs.

Example

See hello.go in _example and/or run it.

go run hello.go

License

Gocchan is licensed under the MIT

About

FeatureToggle library for golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages