environment

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

Documentation

Index

Constants

This section is empty.

Variables

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

EEnvironmentFetch is a GRPC error that is returned when unknown error occurs while fetching an environment.

View Source
var EEnvironmentIDCast = status.Error(
	codes.Internal,
	"could not create a new environment",
)

EEnvironmentIDCast is a GRPC error that is returned when the ID of the environment could not be cast.

View Source
var EEnvironmentNameTaken = status.Error(
	codes.AlreadyExists,
	"an environment with that name already exists",
)

EEnvironmentNameTaken is a GRPC error that is returned when creating a new environment and the provided environment name is already taken.

View Source
var EEnvironmentNotFound = status.Error(codes.NotFound, "environment not found")

EEnvironmentNotFound is a GRPC error that is returned when no environments are found for the provided query.

View Source
var EEnvironmentSave = status.Error(
	codes.Internal,
	"could not create a new environment",
)

EEnvironmentSave is a GRPC error that is returned when an unknown error occurs while creating a new environment.

View Source
var EEnvironmentTxn = status.Error(
	codes.Internal,
	"could not create a transaction session",
)

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

Functions

func NewEnvironmentRepository

func NewEnvironmentRepository(
	ctx context.Context,
	db *mongo.Database,
) (*environmentRepository, error)

Types

type Environment

type Environment 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 EnvironmentRepository

type EnvironmentRepository 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 EnvironmentServer

type EnvironmentServer struct {
	environmentpb.UnimplementedEnvironmentServer
	// contains filtered or unexported fields
}

func NewEnvironmentServer

func NewEnvironmentServer(
	client *mongo.Client,
	userRepo user.UserRepository,
	projectRepo project.ProjectRepository,
	flagSettingRepo flagsetting.FlagSettingRepository,
	environmentRepo EnvironmentRepository,
) *EnvironmentServer

Jump to

Keyboard shortcuts

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