Documentation ¶
Index ¶
- Variables
- type DataRepository
- type Environment
- type MongoDataRepository
- func (r *MongoDataRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*Environment, error)
- func (r *MongoDataRepository) GetByNameAndProjectID(ctx context.Context, environmentName string, projectID primitive.ObjectID) (*Environment, error)
- func (r *MongoDataRepository) Save(ctx context.Context, environment *Environment) (*mongo.InsertOneResult, error)
- type Server
Constants ¶
This section is empty.
Variables ¶
var ErrCouldNotFetch = status.Error( codes.Internal, "error occurred while fetching environment", )
ErrCouldNotFetch is a GRPC error that is returned when unknown error occurs while fetching an environment.
var ErrCouldNotSave = status.Error( codes.Internal, "could not create a new environment", )
ErrCouldNotSave is a GRPC error that is returned when an unknown error occurs while creating a new environment.
var ErrEnvironmentIDCast = status.Error( codes.Internal, "could not create a new environment", )
ErrEnvironmentIDCast is a GRPC error that is returned when the ID of the environment could not be cast.
var ErrNameTaken = status.Error( codes.AlreadyExists, "an environment with that name already exists", )
ErrNameTaken is a GRPC error that is returned when creating a new environment and the provided environment name is already taken.
var ErrNotFound = status.Error(codes.NotFound, "environment not found")
ErrNotFound is a GRPC error that is returned when no environments are found for the provided query.
var ErrTxnSession = status.Error( codes.Internal, "could not create a transaction session", )
ErrTxnSession is a GRPC error that is returned when a new session for starting a transaction could not be created.
Functions ¶
This section is empty.
Types ¶
type DataRepository ¶
type DataRepository interface { // Creates a new `Environment` document. Save( ctx context.Context, environment *Environment, ) (*mongo.InsertOneResult, error) // Gets an `Environment` by it's object ID. GetByID(ctx context.Context, id primitive.ObjectID) (*Environment, error) // Gets an environment by it's name and the project ID. GetByNameAndProjectID( ctx context.Context, environmentName string, projectID primitive.ObjectID, ) (*Environment, error) }
type Environment ¶
type MongoDataRepository ¶
type MongoDataRepository struct {
// contains filtered or unexported fields
}
func (*MongoDataRepository) GetByID ¶
func (r *MongoDataRepository) GetByID( ctx context.Context, id primitive.ObjectID, ) (*Environment, error)
func (*MongoDataRepository) GetByNameAndProjectID ¶
func (r *MongoDataRepository) GetByNameAndProjectID( ctx context.Context, environmentName string, projectID primitive.ObjectID, ) (*Environment, error)
func (*MongoDataRepository) Save ¶
func (r *MongoDataRepository) Save( ctx context.Context, environment *Environment, ) (*mongo.InsertOneResult, error)
type Server ¶
type Server struct { environmentpb.UnimplementedEnvironmentServer // contains filtered or unexported fields }
func NewEnvironmentServer ¶
func NewEnvironmentServer( client *mongo.Client, userDataRepo user.DataRepository, projectDataRepo project.DataRepository, flagSettingDataRepo flagsetting.DataRepository, environmentDataRepo DataRepository, ) *Server
func (*Server) CreateEnvironment ¶
func (s *Server) CreateEnvironment( ctx context.Context, req *environmentpb.CreateEnvironmentRequest, ) (*environmentpb.CreateEnvironmentResponse, error)