capability

package
v0.0.0-...-a423d60 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConverter

func NewConverter(version VersionConverter) *converter

NewConverter returns a new Converter that can later be used to make the conversions between the GraphQL, service, and repository layer representations of a Compass Capability.

func NewRepository

func NewRepository(conv CapabilityConverter) *pgRepository

NewRepository returns a new entity responsible for repo-layer Capabilities operations.

func NewService

func NewService(repo CapabilityRepository, uidService UIDService, specService SpecService) *service

NewService returns a new object responsible for service-layer Capability operations.

Types

type CapabilityCollection

type CapabilityCollection []Entity

CapabilityCollection is an array of Entities

func (CapabilityCollection) Len

func (r CapabilityCollection) Len() int

Len returns the length of the collection

type CapabilityConverter

type CapabilityConverter interface {
	FromEntity(entity *Entity) *model.Capability
	ToEntity(apiModel *model.Capability) *Entity
}

CapabilityConverter converts Capabilities between the model.Capability service-layer representation and the repo-layer representation Entity.

type CapabilityRepository

type CapabilityRepository interface {
	ListByResourceID(ctx context.Context, tenantID string, resourceType resource.Type, resourceID string) ([]*model.Capability, error)
	GetByID(ctx context.Context, tenantID, id string) (*model.Capability, error)
	GetByIDGlobal(ctx context.Context, id string) (*model.Capability, error)
	Create(ctx context.Context, tenant string, item *model.Capability) error
	CreateGlobal(ctx context.Context, item *model.Capability) error
	Update(ctx context.Context, tenant string, item *model.Capability) error
	UpdateGlobal(ctx context.Context, item *model.Capability) error
	Delete(ctx context.Context, tenantID string, id string) error
	DeleteGlobal(ctx context.Context, id string) error
}

CapabilityRepository is responsible for the repo-layer Capability operations.

type Entity

type Entity struct {
	ApplicationID                sql.NullString `db:"app_id"`
	ApplicationTemplateVersionID sql.NullString `db:"app_template_version_id"`
	PackageID                    sql.NullString `db:"package_id"`
	Name                         string         `db:"name"`
	Description                  sql.NullString `db:"description"`
	OrdID                        sql.NullString `db:"ord_id"`
	Type                         string         `db:"type"`
	CustomType                   sql.NullString `db:"custom_type"`
	LocalTenantID                sql.NullString `db:"local_tenant_id"`
	ShortDescription             sql.NullString `db:"short_description"`
	SystemInstanceAware          sql.NullBool   `db:"system_instance_aware"`
	Tags                         sql.NullString `db:"tags"`
	RelatedEntityTypes           sql.NullString `db:"related_entity_types"`
	Links                        sql.NullString `db:"links"`
	ReleaseStatus                sql.NullString `db:"release_status"`
	Labels                       sql.NullString `db:"labels"`
	Visibility                   string         `db:"visibility"`
	ResourceHash                 sql.NullString `db:"resource_hash"`
	DocumentationLabels          sql.NullString `db:"documentation_labels"`
	CorrelationIDs               sql.NullString `db:"correlation_ids"`
	LastUpdate                   sql.NullString `db:"last_update"`

	*repo.BaseEntity
	version.Version
}

Entity is a representation of a Capability in the database.

func (*Entity) DecorateWithTenantID

func (e *Entity) DecorateWithTenantID(tenant string) interface{}

DecorateWithTenantID decorates the entity with the given tenant ID.

func (*Entity) GetParent

func (e *Entity) GetParent(_ resource.Type) (resource.Type, string)

GetParent returns the parent type and the parent ID of the entity.

type SpecService

type SpecService interface {
	CreateByReferenceObjectID(ctx context.Context, in model.SpecInput, resourceType resource.Type, objectType model.SpecReferenceObjectType, objectID string) (string, error)
	UpdateByReferenceObjectID(ctx context.Context, id string, in model.SpecInput, resourceType resource.Type, objectType model.SpecReferenceObjectType, objectID string) error
	GetByReferenceObjectID(ctx context.Context, resourceType resource.Type, objectType model.SpecReferenceObjectType, objectID string) (*model.Spec, error)
	RefetchSpec(ctx context.Context, id string, objectType model.SpecReferenceObjectType) (*model.Spec, error)
	ListFetchRequestsByReferenceObjectIDs(ctx context.Context, tenant string, objectIDs []string, objectType model.SpecReferenceObjectType) ([]*model.FetchRequest, error)
}

SpecService is responsible for the service-layer Specification operations.

type UIDService

type UIDService interface {
	Generate() string
}

UIDService is responsible for generating GUIDs, which will be used as internal capability IDs when they are created.

type VersionConverter

type VersionConverter interface {
	FromEntity(version version.Version) *model.Version
	ToEntity(version model.Version) version.Version
}

VersionConverter converts Version between model.Version, graphql.Version and repo-layer version.Version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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