mongodb

package
v0.0.0-...-57a5977 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver is a store driver that keeps features and gates in mongoDB.

func NewDriver

func NewDriver() *Driver

NewDriver initializes a new mongoDB driver.

func NewDriverWithCollection

func NewDriverWithCollection(c *mgo.Collection) *Driver

NewDriverWithConnection initializes a new mongoDB driver with a given collection. This factory allows you to reused a collection from a session open in your program.

func (*Driver) Configure

func (a *Driver) Configure(c map[string]interface{}) error

Configure configures the mongodb driver. These are the options for this driver:

  • url: string url to the mongoDB cluster (required)
  • database: database name (optional - default to the database in the url, or "test" if also empty)
  • collection: collection name (optional - default "flipper")

This function doesn't do anything if the driver already has a collection configured.

func (*Driver) Disable

func (a *Driver) Disable(feature feature.Feature, gate gates.Gate) error

Disable closes a feature for a given gate.

func (*Driver) Enable

func (a *Driver) Enable(feature feature.Feature, gate gates.Gate) error

Enable opens a feature for a give gate.

func (*Driver) Get

func (a *Driver) Get(feature feature.Feature, keys []gates.GateKey) ([]gates.Gate, error)

Get returns the enabled gates for a feature given a set of gate keys. Gates are skipped if they are not open for a feature.

Jump to

Keyboard shortcuts

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