flagsetting

package
v0.0.0-...-ec63eb9 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EFlagSettingSave = status.Error(
	codes.Internal,
	"could not save flag settings",
)

EFlagSettingSave is a GRPC error that is returned when an unknown error occurs while saving flag settings.

View Source
var EFlagSettingStatusUpdate = status.Error(
	codes.Internal,
	"error occurred while updating the flag setting",
)

EFlagSettingStatusUpdate is a GRPC error that is returned when an error occurs while updating the flag settings status.

Functions

func NewFlagSettingRepository

func NewFlagSettingRepository(
	ctx context.Context,
	db *mongo.Database,
) (*flagSettingRepository, error)

NewFlagSettingRepository creates a new repository that implements the `flagsetting.FlagSettingRepository` interface.

Types

type FlagSetting

type FlagSetting struct {
	ID            primitive.ObjectID `bson:"_id,omitempty"`
	ProjectID     primitive.ObjectID `bson:"project_id"`
	EnvironmentID primitive.ObjectID `bson:"environment_id"`
	FlagID        primitive.ObjectID `bson:"flag_id"`
	IsActive      bool               `bson:"is_active"`
	CreatedAt     time.Time          `bson:"created_at"`
	UpdatedAt     time.Time          `bson:"updated_at"`
}

type FlagSettingRepository

type FlagSettingRepository interface {
	// Save creates a new `FlagSetting`.
	Save(
		ctx context.Context,
		flagSetting *FlagSetting,
	) (*mongo.InsertOneResult, error)

	// SaveMany creates multiple `FlagSetting`s.
	SaveMany(
		ctx context.Context,
		flagSettings []FlagSetting,
	) (*mongo.InsertManyResult, error)

	// Get gets the flag setting by the project ID, environment ID and the
	// flag ID.
	Get(
		ctx context.Context,
		projectID primitive.ObjectID,
		environmentID primitive.ObjectID,
		flagID primitive.ObjectID,
	) (*FlagSetting, error)

	// UpdateIsActive updates a flag setting's `IsActive` field to the provided
	// value.
	UpdateIsActive(
		ctx context.Context,
		projectID primitive.ObjectID,
		environmentID primitive.ObjectID,
		flagID primitive.ObjectID,
		isActive bool,
	) (*mongo.UpdateResult, error)
}

Jump to

Keyboard shortcuts

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