eventdef

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConverter

func NewConverter(vc VersionConverter, sc SpecConverter) *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 EventDefinition.

func NewRepository

func NewRepository(conv EventAPIDefinitionConverter) *pgRepository

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

func NewService

func NewService(eventAPIRepo EventAPIRepository, uidService UIDService, specService SpecService, bundleReferenceService BundleReferenceService) *service

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

Types

type BundleReferenceService

type BundleReferenceService interface {
	GetForBundle(ctx context.Context, objectType model.BundleReferenceObjectType, objectID, bundleID *string) (*model.BundleReference, error)
	CreateByReferenceObjectID(ctx context.Context, in model.BundleReferenceInput, objectType model.BundleReferenceObjectType, objectID, bundleID *string) error
	UpdateByReferenceObjectID(ctx context.Context, in model.BundleReferenceInput, objectType model.BundleReferenceObjectType, objectID, bundleID *string) error
	DeleteByReferenceObjectID(ctx context.Context, objectType model.BundleReferenceObjectType, objectID, bundleID *string) error
	ListByBundleIDs(ctx context.Context, objectType model.BundleReferenceObjectType, bundleIDs []string, pageSize int, cursor string) ([]*model.BundleReference, map[string]int, error)
}

BundleReferenceService is responsible for the service-layer BundleReference operations.

type BundleService

type BundleService interface {
	Get(ctx context.Context, id string) (*model.Bundle, error)
}

BundleService is responsible for the service-layer Bundle 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"`
	GroupName                               sql.NullString `db:"group_name"`
	OrdID                                   sql.NullString `db:"ord_id"`
	LocalTenantID                           sql.NullString `db:"local_tenant_id"`
	ShortDescription                        sql.NullString `db:"short_description"`
	SystemInstanceAware                     sql.NullBool   `db:"system_instance_aware"`
	PolicyLevel                             sql.NullString `db:"policy_level"`
	CustomPolicyLevel                       sql.NullString `db:"custom_policy_level"`
	ChangeLogEntries                        sql.NullString `db:"changelog_entries"`
	Links                                   sql.NullString `db:"links"`
	EventResourceLinks                      sql.NullString `db:"event_resource_links"`
	Tags                                    sql.NullString `db:"tags"`
	Countries                               sql.NullString `db:"countries"`
	ReleaseStatus                           sql.NullString `db:"release_status"`
	SunsetDate                              sql.NullString `db:"sunset_date"`
	Successors                              sql.NullString `db:"successors"`
	Labels                                  sql.NullString `db:"labels"`
	Visibility                              string         `db:"visibility"`
	Disabled                                sql.NullBool   `db:"disabled"`
	PartOfProducts                          sql.NullString `db:"part_of_products"`
	LineOfBusiness                          sql.NullString `db:"line_of_business"`
	Industry                                sql.NullString `db:"industry"`
	ImplementationStandard                  sql.NullString `db:"implementation_standard"`
	CustomImplementationStandard            sql.NullString `db:"custom_implementation_standard"`
	CustomImplementationStandardDescription sql.NullString `db:"custom_implementation_standard_description"`
	Extensible                              sql.NullString `db:"extensible"`
	ResourceHash                            sql.NullString `db:"resource_hash"`
	DocumentationLabels                     sql.NullString `db:"documentation_labels"`
	CorrelationIDs                          sql.NullString `db:"correlation_ids"`
	LastUpdate                              sql.NullString `db:"last_update"`
	DeprecationDate                         sql.NullString `db:"deprecation_date"`
	Responsible                             sql.NullString `db:"responsible"`
	version.Version

	*repo.BaseEntity
}

Entity is a representation of a single EventDefinition 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 EventAPIDefCollection

type EventAPIDefCollection []Entity

EventAPIDefCollection is an array of Entities

func (EventAPIDefCollection) Len

func (r EventAPIDefCollection) Len() int

Len returns the length of the collection

type EventAPIDefinitionConverter

type EventAPIDefinitionConverter interface {
	FromEntity(entity *Entity) *model.EventDefinition
	ToEntity(apiModel *model.EventDefinition) *Entity
}

EventAPIDefinitionConverter converts EventDefinitions between the model.EventDefinition service-layer representation and the repo-layer representation Entity.

type EventAPIRepository

type EventAPIRepository interface {
	GetByID(ctx context.Context, tenantID string, id string) (*model.EventDefinition, error)
	GetByIDGlobal(ctx context.Context, id string) (*model.EventDefinition, error)
	GetForBundle(ctx context.Context, tenant string, id string, bundleID string) (*model.EventDefinition, error)
	GetByApplicationID(ctx context.Context, tenantID string, id, appID string) (*model.EventDefinition, error)
	ListByBundleIDs(ctx context.Context, tenantID string, bundleIDs []string, bundleRefs []*model.BundleReference, totalCounts map[string]int, pageSize int, cursor string) ([]*model.EventDefinitionPage, error)
	ListByResourceID(ctx context.Context, tenantID, resourceID string, resourceType resource.Type) ([]*model.EventDefinition, error)
	ListByApplicationIDPage(ctx context.Context, tenantID string, appID string, pageSize int, cursor string) (*model.EventDefinitionPage, error)
	Create(ctx context.Context, tenant string, item *model.EventDefinition) error
	CreateGlobal(ctx context.Context, item *model.EventDefinition) error
	Update(ctx context.Context, tenant string, item *model.EventDefinition) error
	UpdateGlobal(ctx context.Context, item *model.EventDefinition) error
	Delete(ctx context.Context, tenantID string, id string) error
	DeleteGlobal(ctx context.Context, id string) error
	DeleteAllByBundleID(ctx context.Context, tenantID, bundleID string) error
}

EventAPIRepository is responsible for the repo-layer EventDefinition operations.

type EventDefConverter

type EventDefConverter interface {
	ToGraphQL(in *model.EventDefinition, spec *model.Spec, bundleReference *model.BundleReference) (*graphql.EventDefinition, error)
	InputFromGraphQL(in *graphql.EventDefinitionInput) (*model.EventDefinitionInput, *model.SpecInput, error)
}

EventDefConverter converts EventDefinitions between the model.EventDefinition service-layer representation and the graphql-layer representation.

type EventDefService

type EventDefService interface {
	CreateInBundle(ctx context.Context, resourceType resource.Type, resourceID string, bundleID string, in model.EventDefinitionInput, spec *model.SpecInput) (string, error)
	CreateInApplication(ctx context.Context, appID string, in model.EventDefinitionInput, spec *model.SpecInput) (string, error)
	Update(ctx context.Context, resourceType resource.Type, id string, in model.EventDefinitionInput, spec *model.SpecInput) error
	UpdateForApplication(ctx context.Context, id string, in model.EventDefinitionInput, specIn *model.SpecInput) error
	Get(ctx context.Context, id string) (*model.EventDefinition, error)
	Delete(ctx context.Context, resourceType resource.Type, id string) error
	ListByApplicationIDPage(ctx context.Context, appID string, pageSize int, cursor string) (*model.EventDefinitionPage, error)
	ListFetchRequests(ctx context.Context, eventDefIDs []string) ([]*model.FetchRequest, error)
}

EventDefService is responsible for the service-layer EventDefinition operations.

type FetchRequestConverter

type FetchRequestConverter interface {
	ToGraphQL(in *model.FetchRequest) (*graphql.FetchRequest, error)
}

FetchRequestConverter converts FetchRequest from the model.FetchRequest service-layer representation to the graphql-layer one.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver is an object responsible for resolver-layer EventDefinition operations

func NewResolver

func NewResolver(transact persistence.Transactioner, svc EventDefService, bndlSvc BundleService, bndlRefSvc BundleReferenceService, converter EventDefConverter, frConverter FetchRequestConverter, specService SpecService, specConverter SpecConverter) *Resolver

NewResolver returns a new object responsible for resolver-layer EventDefinition operations.

func (*Resolver) AddEventDefinitionToApplication

func (r *Resolver) AddEventDefinitionToApplication(ctx context.Context, appID string, in graphql.EventDefinitionInput) (*graphql.EventDefinition, error)

AddEventDefinitionToApplication adds an EventDefinition in the context of an Application without Bundle

func (*Resolver) AddEventDefinitionToBundle

func (r *Resolver) AddEventDefinitionToBundle(ctx context.Context, bundleID string, in graphql.EventDefinitionInput) (*graphql.EventDefinition, error)

AddEventDefinitionToBundle adds an EventDefinition to a Bundle with a given ID.

func (*Resolver) DeleteEventDefinition

func (r *Resolver) DeleteEventDefinition(ctx context.Context, id string) (*graphql.EventDefinition, error)

DeleteEventDefinition deletes an EventDefinition by its ID.

func (*Resolver) EventDefinitionsForApplication

func (r *Resolver) EventDefinitionsForApplication(ctx context.Context, appID string, first *int, after *graphql.PageCursor) (*graphql.EventDefinitionPage, error)

EventDefinitionsForApplication lists all EventDefinitions for a given application ID with paging.

func (*Resolver) FetchRequest

func (r *Resolver) FetchRequest(ctx context.Context, obj *graphql.EventSpec) (*graphql.FetchRequest, error)

FetchRequest returns a FetchRequest by a given EventSpec via dataloaders.

func (*Resolver) FetchRequestEventDefDataLoader

func (r *Resolver) FetchRequestEventDefDataLoader(keys []dataloader.ParamFetchRequestEventDef) ([]*graphql.FetchRequest, []error)

FetchRequestEventDefDataLoader is the dataloader implementation.

func (*Resolver) RefetchEventDefinitionSpec

func (r *Resolver) RefetchEventDefinitionSpec(ctx context.Context, eventID string) (*graphql.EventSpec, error)

RefetchEventDefinitionSpec refetches an EventDefinitionSpec for EventDefinition with given ID.

func (*Resolver) Spec

Spec fetches the Spec for a given EventDefinition

func (*Resolver) UpdateEventDefinition

func (r *Resolver) UpdateEventDefinition(ctx context.Context, id string, in graphql.EventDefinitionInput) (*graphql.EventDefinition, error)

UpdateEventDefinition updates an EventDefinition by its ID.

func (*Resolver) UpdateEventDefinitionForApplication

func (r *Resolver) UpdateEventDefinitionForApplication(ctx context.Context, id string, in graphql.EventDefinitionInput) (*graphql.EventDefinition, error)

UpdateEventDefinitionForApplication updates an EventDefinition for Application without being in a Bundle

type SpecConverter

type SpecConverter interface {
	ToGraphQLEventSpec(in *model.Spec) (*graphql.EventSpec, error)
	InputFromGraphQLEventSpec(in *graphql.EventSpecInput) (*model.SpecInput, error)
}

SpecConverter converts Specifications between the model.Spec service-layer representation and the graphql-layer representation graphql.EventSpec.

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 eventDefinition IDs when they are created.

type VersionConverter

type VersionConverter interface {
	ToGraphQL(in *model.Version) *graphql.Version
	InputFromGraphQL(in *graphql.VersionInput) *model.VersionInput
	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