flagsetting

package
v0.0.0-...-677f796 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCouldNotGet = status.Error(
	codes.Internal,
	"could not get flag setting",
)

ErrCouldNotGet is a GRPC error that is returned when the current status of the flag could be retrieved.

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

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

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

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

Functions

This section is empty.

Types

type DataRepository

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

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

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

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

type FlagSetting

type FlagSetting struct {
	ID            string
	ProjectID     string
	EnvironmentID string
	FlagID        string
	IsActive      bool
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type MongoDataRepository

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

func NewFlagSettingRepository

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

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

func (*MongoDataRepository) Get

func (r *MongoDataRepository) Get(
	ctx context.Context,
	projectID string,
	environmentID string,
	flagID string,
) (*FlagSetting, error)

func (*MongoDataRepository) Save

func (r *MongoDataRepository) Save(
	ctx context.Context,
	flagSetting *FlagSetting,
) (string, error)

func (*MongoDataRepository) SaveMany

func (r *MongoDataRepository) SaveMany(
	ctx context.Context,
	flagSettings []FlagSetting,
) ([]string, error)

func (*MongoDataRepository) UpdateIsActive

func (r *MongoDataRepository) UpdateIsActive(
	ctx context.Context,
	projectID string,
	environmentID string,
	flagID string,
	isActive bool,
) (uint, error)

Jump to

Keyboard shortcuts

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