flag

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EFlagFetch = status.Error(
	codes.Internal,
	"error occurred while fetching flag",
)

EFlagFetch is a GRPC error that is returned when an unknown error occurs while fetching a flag.

View Source
var EFlagNameTaken = status.Error(
	codes.AlreadyExists,
	"a flag with that name already exists",
)

EFlagNameTaken is a GRPC error that is returned when attempting to save a new flag and the flag name has already been taken.

View Source
var EFlagNotFound = status.Error(codes.NotFound, "flag not found")

EFlagNotFound is a GRPC error that is returned when the requested flag was not found.

View Source
var EFlagSave = status.Error(
	codes.Internal,
	"error occurred while saving the flag",
)

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

View Source
var EFlagSaveTxn = status.Error(
	codes.Internal,
	"could start the transaction to save flag",
)

EFlagSaveTxn is a GRPC error that is returned when a new session for starting a transaction could not be created.

View Source
var ENoEnvironments = status.Error(
	codes.FailedPrecondition,
	"no environments have been configured for the project",
)

ENoEnvironments is a GRPC error that is returned when no environments have been configured and the user tries to create a new flag.

View Source
var EUpdateFlagStatus = status.Error(
	codes.Internal,
	"no flag settings could be updated",
)

EUpdateFlagStatus is a GRPC error that is returned when the status of a flag could not be updated.

Functions

func NewFlagRepository

func NewFlagRepository(
	ctx context.Context,
	db *mongo.Database,
) (*flagRepository, error)

Types

type Flag

type Flag struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	Name      string             `bson:"name"`
	ProjectID primitive.ObjectID `bson:"project_id"`
	CreatedBy primitive.ObjectID `bson:"created_by"`
	CreatedAt time.Time          `bson:"created_at"`
}

type FlagRepository

type FlagRepository interface {
	// Save creates a new `Flag` document.
	Save(ctx context.Context, flag *Flag) (*mongo.InsertOneResult, error)

	// GetByID gets a `Flag` by it's object ID.
	GetByID(ctx context.Context, flagID primitive.ObjectID) (*Flag, error)

	// GetByNameAndProjectID gets a `Flag` by it's name and the ID of the
	// project that it belongs to.
	GetByNameAndProjectID(
		ctx context.Context,
		flagName string,
		projectID primitive.ObjectID,
	) (*Flag, error)
}

type FlagServer

type FlagServer struct {
	flagpb.UnimplementedFlagServer
	// contains filtered or unexported fields
}

func NewFlagServer

func NewFlagServer(
	mongoClient *mongo.Client,
	userRepo user.UserRepository,
	projectRepo project.ProjectRepository,
	environmentRepo environment.EnvironmentRepository,
	flagRepo FlagRepository,
	flagSettingRepo flagsetting.FlagSettingRepository,
) *FlagServer

NewFlagServer creates a new `FlagServer` for serving GRPC requests.

func (*FlagServer) CreateFlag

func (*FlagServer) UpdateFlagStatus

Jump to

Keyboard shortcuts

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