Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
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.
var EFlagNotFound = status.Error(codes.NotFound, "flag not found")
EFlagNotFound is a GRPC error that is returned when the requested flag was not found.
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.
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.
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.
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 ¶
Types ¶
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 (s *FlagServer) CreateFlag( ctx context.Context, req *flagpb.CreateFlagRequest, ) (*flagpb.CreateFlagResponse, error)
func (*FlagServer) UpdateFlagStatus ¶
func (s *FlagServer) UpdateFlagStatus( ctx context.Context, req *flagpb.UpdateFlagStatusRequest, ) (*flagpb.UpdateFlagStatusResponse, error)