model

package
v0.0.0-...-64de597 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultQueryTimeout = 3 * time.Second
View Source
const FeatureLabCollection = "featurelab"
View Source
const FeatureLabDB = "featurelabdb"

Variables

View Source
var ErrDuplicateEntry = errors.New("entry already exists")
View Source
var ErrNoEntry = errors.New("no entry exists")

Functions

func ToFeature

func ToFeature(featureEntity FeatureEntity) featurelab.Feature

func ToFeatureAllocations

func ToFeatureAllocations(allocationEntities []FeatureAllocationEntity) []featurelab.FeatureAllocation

func ToFeatures

func ToFeatures(featureEntities []FeatureEntity) []featurelab.Feature

Types

type FeatureAllocationEntity

type FeatureAllocationEntity struct {
	Treatment string `bson:"treatment"`
	Weight    uint32 `bson:"weight"`
}

func ToFeatureAllocationEntities

func ToFeatureAllocationEntities(allocations []featurelab.FeatureAllocation) []FeatureAllocationEntity

type FeatureEntity

type FeatureEntity struct {
	Id          string                    `bson:"_id"`
	CreatedTime string                    `bson:"createdTime"`
	UpdatedTime string                    `bson:"updatedTime"`
	App         string                    `bson:"app"`
	Feature     string                    `bson:"feature"`
	Allocations []FeatureAllocationEntity `bson:"allocations"`
}

func ToFeatureEntity

func ToFeatureEntity(feature featurelab.Feature) FeatureEntity

type FeatureLabDAO

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

func NewFeatureLabDAO

func NewFeatureLabDAO(ctx context.Context, mongoURI string, queryTimeout time.Duration) (dao *FeatureLabDAO, disconnect func())

func (*FeatureLabDAO) CreateFeature

func (dao *FeatureLabDAO) CreateFeature(feature featurelab.Feature) (FeatureEntity, error)

func (*FeatureLabDAO) FetchFeature

func (dao *FeatureLabDAO) FetchFeature(app, featureName string) (FeatureEntity, bool, error)

FetchFeature looks up a feature using app and feature name. It returns a FeatureEntity, a boolean that specifies whether the record was found, and an error in case any happened.

func (*FeatureLabDAO) FetchFeatures

func (dao *FeatureLabDAO) FetchFeatures(app string) ([]FeatureEntity, error)

func (*FeatureLabDAO) UpdateFeature

func (dao *FeatureLabDAO) UpdateFeature(feature featurelab.Feature) (FeatureEntity, error)

Jump to

Keyboard shortcuts

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