service

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package service contains the service layer for entity creation

Package service contains the service layer for entity instances

Index

Constants

This section is empty.

Variables

View Source
var ErrEntityNotFound = errors.New("entity not found")

ErrEntityNotFound is returned when an entity is not found

Functions

This section is empty.

Types

type EntityCreationOptions added in v0.1.2

type EntityCreationOptions struct {
	// Parent entity ID (for originated entities like artifacts, releases)
	OriginatingEntityID *uuid.UUID

	// Whether to register with provider (e.g., create webhooks)
	RegisterWithProvider bool

	// Whether to publish reconciliation events
	PublishReconciliationEvent bool
}

EntityCreationOptions configures entity creation behavior

type EntityCreator added in v0.1.2

type EntityCreator interface {
	// CreateEntity creates an entity of any type
	CreateEntity(
		ctx context.Context,
		provider *db.Provider,
		projectID uuid.UUID,
		entityType pb.Entity,
		identifyingProps *properties.Properties,
		opts *EntityCreationOptions,
	) (*models.EntityWithProperties, error)
}

EntityCreator creates entities in a consistent, reusable way

func NewEntityCreator added in v0.1.2

func NewEntityCreator(
	store db.Store,
	propSvc propService.PropertiesService,
	providerManager manager.ProviderManager,
	eventProducer interfaces.Publisher,
	validatorRegistry validators.ValidatorRegistry,
) EntityCreator

NewEntityCreator creates a new EntityCreator

type EntityService

type EntityService interface {
	// ListEntities retrieves all entities for the specific project and provider
	ListEntities(
		ctx context.Context,
		projectID uuid.UUID,
		providerID uuid.UUID,
		entityType pb.Entity,
		cursor string,
		limit int64,
	) ([]*pb.EntityInstance, string, error)

	// GetEntityByID retrieves an entity by its ID
	GetEntityByID(
		ctx context.Context,
		entityID uuid.UUID,
		projectID uuid.UUID,
	) (*pb.EntityInstance, error)

	// GetEntityByName retrieves an entity by its name
	GetEntityByName(
		ctx context.Context,
		name string,
		projectID uuid.UUID,
		providerID uuid.UUID,
		entityType pb.Entity,
	) (*pb.EntityInstance, error)

	// DeleteEntityByID deletes an entity by its ID
	DeleteEntityByID(
		ctx context.Context,
		entityID uuid.UUID,
		projectID uuid.UUID,
	) error
}

EntityService encapsulates logic related to entity instances

func NewEntityService

func NewEntityService(
	store db.Store,
	propSvc propService.PropertiesService,
	providerManager manager.ProviderManager,
) EntityService

NewEntityService creates a new instance of the EntityService interface

Directories

Path Synopsis
Package mock_service is a generated GoMock package.
Package mock_service is a generated GoMock package.
Package validators contains entity validation logic
Package validators contains entity validation logic

Jump to

Keyboard shortcuts

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