growthbook

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFeature

func DeleteFeature(ctx context.Context, feature Feature, db storage.Database) error

func DeleteOrganization

func DeleteOrganization(ctx context.Context, org Organization, db storage.Database) error

func DeleteSDKConnection

func DeleteSDKConnection(ctx context.Context, sdkconnection SDKConnection, db storage.Database) error

func DeleteUser

func DeleteUser(ctx context.Context, user User, db storage.Database) error

func UpdateFeature

func UpdateFeature(ctx context.Context, feature Feature, db storage.Database) error

func UpdateOrganization

func UpdateOrganization(ctx context.Context, org Organization, db storage.Database) error

func UpdateSDKConnection

func UpdateSDKConnection(ctx context.Context, sdkconnection SDKConnection, db storage.Database) error

func UpdateUser

func UpdateUser(ctx context.Context, user User, db storage.Database) error

Types

type EnvironmentSetting

type EnvironmentSetting struct {
	Enabled bool          `bson:"enabled"`
	Rules   []FeatureRule `bson:"rules"`
}

type ExperimentRefVariation added in v0.4.1

type ExperimentRefVariation struct {
	VariationId string `bson:"variationId,omitempty"`
	Value       string `bson:"value,omitempty"`
}

type ExperimentValue added in v0.4.0

type ExperimentValue struct {
	ID     string  `bson:"id,omitempty"`
	Value  string  `bson:"value,omitempty"`
	Weight float64 `bson:"weight,omitempty"`
	Name   *string `bson:"name,omitempty"`
}

type Feature

type Feature struct {
	ID                  string                        `bson:"id"`
	Owner               string                        `bson:"owner"`
	Description         string                        `bson:"description"`
	Tags                []string                      `bson:"tags"`
	DefaultValue        string                        `bson:"defaultValue"`
	ValueType           FeatureValueType              `bson:"valueType"`
	Organization        string                        `bson:"organization"`
	Environments        []string                      `bson:"environment"`
	EnvironmentSettings map[string]EnvironmentSetting `bson:"environmentSettings"`
	DateCreated         time.Time                     `bson:"dateCreated"`
	DateUpdated         time.Time                     `bson:"dateUpdated"`
	Archived            bool                          `bson:"archived"`
	Revision            int                           `bson:"__v"`
}

func (*Feature) FromV1beta1

func (f *Feature) FromV1beta1(feature v1beta1.GrowthbookFeature) *Feature

type FeaturePrerequisite added in v0.4.0

type FeaturePrerequisite struct {
	ID        string `bson:"id,omitempty"`
	Condition string `bson:"condition,omitempty"`
}

type FeatureRule added in v0.4.0

type FeatureRule struct {
	ID                     string                   `bson:"id,omitempty"`
	Type                   FeatureRuleType          `bson:"type,omitempty"`
	Description            string                   `bson:"description,omitempty"`
	Condition              string                   `bson:"condition,omitempty"`
	Enabled                bool                     `bson:"enabled,omitempty"`
	ScheduleRules          []ScheduleRule           `bson:"scheduleRules,omitempty"`
	SavedGroups            []SavedGroupTargeting    `bson:"savedGroups,omitempty"`
	Prerequisites          []FeaturePrerequisite    `bson:"prerequisites,omitempty"`
	Value                  string                   `bson:"value,omitempty"`
	Coverage               float64                  `bson:"coverage,omitempty"`
	HashAttribute          string                   `bson:"hashAttribute,omitempty"`
	TrackingKey            string                   `bson:"trackingKey,omitempty"`
	FallbackAttribute      *string                  `bson:"fallbackAttribute,omitempty"`
	DisableStickyBucketing *bool                    `bson:"disableStickyBucketing,omitempty"`
	BucketVersion          *float64                 `bson:"bucketVersion,omitempty"`
	MinBucketVersion       *float64                 `bson:"minBucketVersion,omitempty"`
	Namespace              *NamespaceValue          `bson:"namespace,omitempty"`
	Values                 []ExperimentValue        `bson:"values,omitempty"`
	ExperimentID           string                   `bson:"experimentId,omitempty"`
	Variations             []ExperimentRefVariation `bson:"variations,omitempty"`
}

type FeatureRuleType added in v0.4.0

type FeatureRuleType string
var (
	FeatureRuleTypeForce         FeatureRuleType = "force"
	FeatureRuleTypeRollout       FeatureRuleType = "rollout"
	FeatureRuleTypeExperiment    FeatureRuleType = "experiment"
	FeatureRuleTypeExperimentRef FeatureRuleType = "experiment-ref"
)

type FeatureValueType

type FeatureValueType string
var (
	FeatureValueTypeBoolean FeatureValueType = "boolean"
	FeatureValueTypeString  FeatureValueType = "string"
	FeatureValueTypeNumber  FeatureValueType = "number"
	FeatureValueTypeJSON    FeatureValueType = "json"
)

type MockCollection

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

func (*MockCollection) DeleteMany

func (c *MockCollection) DeleteMany(ctx context.Context, filter interface{}) error

func (*MockCollection) DeleteOne

func (c *MockCollection) DeleteOne(ctx context.Context, filter interface{}) error

func (*MockCollection) FindOne

func (c *MockCollection) FindOne(ctx context.Context, filter interface{}) (storage.Decoder, error)

func (*MockCollection) InsertOne

func (c *MockCollection) InsertOne(ctx context.Context, doc interface{}) error

func (*MockCollection) UpdateOne

func (c *MockCollection) UpdateOne(ctx context.Context, filter interface{}, doc interface{}) error

type MockDatabase

type MockDatabase struct {
	FindOne    func(ctx context.Context, filter interface{}) (storage.Decoder, error)
	DeleteOne  func(ctx context.Context, filter interface{}) error
	InsertOne  func(ctx context.Context, doc interface{}) error
	UpdateOne  func(ctx context.Context, filter interface{}, doc interface{}) error
	DeleteMany func(ctx context.Context, filter interface{}) error
}

func (*MockDatabase) Collection

func (d *MockDatabase) Collection(collName string) storage.Collection

type MockDisconnect

type MockDisconnect struct {
}

func (*MockDisconnect) Disconnect

func (d *MockDisconnect) Disconnect(ctx context.Context) error

type MockResult added in v0.4.2

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

func (*MockResult) Decode added in v0.4.2

func (r *MockResult) Decode(dst interface{}) error

type NamespaceValue added in v0.4.0

type NamespaceValue struct {
	Enabled bool      `bson:"enabled,omitempty"`
	Name    string    `bson:"name,omitempty"`
	Range   []float64 `bson:"range,omitempty"`
}

type Organization

type Organization struct {
	ID          string               `bson:"id"`
	OwnerEmail  string               `bson:"ownerEmail"`
	Name        string               `bson:"name"`
	DateCreated time.Time            `bson:"dateCreated"`
	Members     []OrganizationMember `bson:"members"`
	Revision    int                  `bson:"__v"`
}

func (*Organization) FromV1beta1

type OrganizationMember

type OrganizationMember struct {
	ID   string `bson:"id"`
	Role string `bson:"role"`
}

type SDKConnection

type SDKConnection struct {
	ID                       string             `bson:"id"`
	Key                      string             `bson:"key"`
	Languages                []string           `bson:"languages"`
	Name                     string             `bson:"name"`
	Environment              string             `bson:"environment"`
	EncryptPayload           bool               `bson:"encryptPayload"`
	EncryptionKey            string             `bson:"encryptionKey"`
	Organization             string             `bson:"organization"`
	Project                  string             `bson:"project"`
	IncludeVisualExperiments bool               `bson:"includeVisualExperiments"`
	IncludeDraftExperiments  bool               `bson:"includeDraftExperiments"`
	IncludeExperimentNames   bool               `bson:"includeExperimentNames"`
	DateCreated              time.Time          `bson:"dateCreated"`
	DateUpdated              time.Time          `bson:"dateUpdated"`
	Proxy                    SDKConnectionProxy `bson:"proxy"`
	Revision                 int                `bson:"__v"`
}

func (*SDKConnection) FromV1beta1

func (s *SDKConnection) FromV1beta1(client v1beta1.GrowthbookClient) *SDKConnection

type SDKConnectionProxy

type SDKConnectionProxy struct {
	SigningKey string `bson:"signingKey"`
}

type SavedGroupTargeting added in v0.4.0

type SavedGroupTargeting struct {
	Match SavedGroupTargetingMatch `bson:"match,omitempty"`
	IDs   []string                 `bson:"ids,omitempty"`
}

type SavedGroupTargetingMatch added in v0.4.0

type SavedGroupTargetingMatch string
var (
	SavedGroupTargetingMatchAll  SavedGroupTargetingMatch = "all"
	SavedGroupTargetingMatchNone SavedGroupTargetingMatch = "none"
	SavedGroupTargetingMatchAny  SavedGroupTargetingMatch = "any"
)

type ScheduleRule added in v0.4.0

type ScheduleRule struct {
	Timestamp string `bson:"timestamp,omitempty"`
	Enabled   bool   `bson:"enabled,omitempty"`
}

type User

type User struct {
	ID           string `bson:"id"`
	Email        string `bson:"email"`
	Name         string `bson:"name"`
	PasswordHash string `bson:"passwordHash"`
	Revision     int    `bson:"__v"`
}

func (*User) FromV1beta1

func (u *User) FromV1beta1(user v1beta1.GrowthbookUser) *User

Jump to

Keyboard shortcuts

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