Documentation ¶
Index ¶
- Variables
- func NewConverter(webhook WebhookConverter) *converter
- func NewRepository(conv EntityConverter) *repository
- func NewService(repo FormationTemplateRepository, uidSvc UIDService, ...) *service
- type Entity
- type EntityCollection
- type EntityConverter
- type FormationConstraintConverter
- type FormationConstraintService
- type FormationTemplateConverter
- type FormationTemplateRepository
- type FormationTemplateService
- type Resolver
- func (r *Resolver) CreateFormationTemplate(ctx context.Context, in graphql.FormationTemplateRegisterInput) (*graphql.FormationTemplate, error)
- func (r *Resolver) DeleteFormationTemplate(ctx context.Context, id string) (*graphql.FormationTemplate, error)
- func (r *Resolver) DeleteFormationTemplateLabel(ctx context.Context, formationTemplateID, key string) (*graphql.Label, error)
- func (r *Resolver) FormationConstraint(ctx context.Context, obj *graphql.FormationTemplate) ([]*graphql.FormationConstraint, error)
- func (r *Resolver) FormationConstraintsDataLoader(keys []dataloader.ParamFormationConstraint) ([][]*graphql.FormationConstraint, []error)
- func (r *Resolver) FormationTemplate(ctx context.Context, id string) (*graphql.FormationTemplate, error)
- func (r *Resolver) FormationTemplates(ctx context.Context, filters []*graphql.LabelFilter, first *int, ...) (*graphql.FormationTemplatePage, error)
- func (r *Resolver) FormationTemplatesByName(ctx context.Context, name *string, first *int, after *graphql.PageCursor) (*graphql.FormationTemplatePage, error)
- func (r *Resolver) Labels(ctx context.Context, obj *graphql.FormationTemplate, key *string) (graphql.Labels, error)
- func (r *Resolver) SetFormationTemplateLabel(ctx context.Context, formationTemplateID string, lblInput graphql.LabelInput) (*graphql.Label, error)
- func (r *Resolver) UpdateFormationTemplate(ctx context.Context, id string, in graphql.FormationTemplateUpdateInput) (*graphql.FormationTemplate, error)
- func (r *Resolver) Webhooks(ctx context.Context, obj *graphql.FormationTemplate) ([]*graphql.Webhook, error)
- type TenantService
- type UIDService
- type WebhookConverter
- type WebhookRepository
- type WebhookService
Constants ¶
This section is empty.
Variables ¶
var ( // Now is a function variable that returns the current time. It is used, so we could mock it in the tests. Now = time.Now )
Functions ¶
func NewConverter ¶
func NewConverter(webhook WebhookConverter) *converter
NewConverter creates a new instance of gqlConverter
func NewRepository ¶
func NewRepository(conv EntityConverter) *repository
NewRepository creates a new FormationTemplate repository
func NewService ¶
func NewService(repo FormationTemplateRepository, uidSvc UIDService, converter FormationTemplateConverter, tenantSvc TenantService, webhookRepo WebhookRepository, webhookService WebhookService, labelService labelService) *service
NewService creates a FormationTemplate service
Types ¶
type Entity ¶
type Entity struct { ID string `db:"id"` Name string `db:"name"` ApplicationTypes string `db:"application_types"` RuntimeTypes sql.NullString `db:"runtime_types"` RuntimeTypeDisplayName sql.NullString `db:"runtime_type_display_name"` RuntimeArtifactKind sql.NullString `db:"runtime_artifact_kind"` LeadingProductIDs sql.NullString `db:"leading_product_ids"` TenantID sql.NullString `db:"tenant_id"` SupportsReset bool `db:"supports_reset"` DiscoveryConsumers sql.NullString `db:"discovery_consumers"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` }
Entity represents the formation template entity
type EntityCollection ¶
type EntityCollection []*Entity
EntityCollection is a collection of formation template entities.
func (EntityCollection) Len ¶
func (s EntityCollection) Len() int
Len returns the number of entities in the collection.
type EntityConverter ¶
type EntityConverter interface { ToEntity(in *model.FormationTemplate) (*Entity, error) FromEntity(entity *Entity) (*model.FormationTemplate, error) }
EntityConverter converts between the internal model and entity
type FormationConstraintConverter ¶
type FormationConstraintConverter interface {
MultipleToGraphQL(in []*model.FormationConstraint) []*graphql.FormationConstraint
}
FormationConstraintConverter represents the FormationConstraint converter
type FormationConstraintService ¶
type FormationConstraintService interface {
ListByFormationTemplateIDs(ctx context.Context, formationTemplateIDs []string) ([][]*model.FormationConstraint, error)
}
FormationConstraintService represents the FormationConstraint service layer
type FormationTemplateConverter ¶
type FormationTemplateConverter interface { FromRegisterInputGraphQL(in *graphql.FormationTemplateRegisterInput) (*model.FormationTemplateRegisterInput, error) FromUpdateInputGraphQL(in *graphql.FormationTemplateUpdateInput) (*model.FormationTemplateUpdateInput, error) ToGraphQL(in *model.FormationTemplate) (*graphql.FormationTemplate, error) MultipleToGraphQL(in []*model.FormationTemplate) ([]*graphql.FormationTemplate, error) FromModelRegisterInputToModel(in *model.FormationTemplateRegisterInput, id string, tenantID string) *model.FormationTemplate FromModelUpdateInputToModel(in *model.FormationTemplateUpdateInput, id string, tenantID string) *model.FormationTemplate }
FormationTemplateConverter converts between the graphql and model
type FormationTemplateRepository ¶
type FormationTemplateRepository interface { Create(ctx context.Context, item *model.FormationTemplate) error Get(ctx context.Context, id string) (*model.FormationTemplate, error) List(ctx context.Context, filters []*labelfilter.LabelFilter, name *string, tenantID string, pageSize int, cursor string) (*model.FormationTemplatePage, error) Update(ctx context.Context, model *model.FormationTemplate) error Delete(ctx context.Context, id, tenantID string) error ExistsGlobal(ctx context.Context, id string) (bool, error) }
FormationTemplateRepository represents the FormationTemplate repository layer
type FormationTemplateService ¶
type FormationTemplateService interface { Create(ctx context.Context, in *model.FormationTemplateRegisterInput) (string, error) Get(ctx context.Context, id string) (*model.FormationTemplate, error) List(ctx context.Context, filters []*labelfilter.LabelFilter, name *string, pageSize int, cursor string) (*model.FormationTemplatePage, error) Update(ctx context.Context, id string, in *model.FormationTemplateUpdateInput) error Delete(ctx context.Context, id string) error ListWebhooksForFormationTemplate(ctx context.Context, formationTemplateID string) ([]*model.Webhook, error) SetLabel(ctx context.Context, label *model.LabelInput) error GetLabel(ctx context.Context, formationTemplateID string, key string) (*model.Label, error) DeleteLabel(ctx context.Context, formationTemplateID string, key string) error ListLabels(ctx context.Context, formationTemplateID string) (map[string]*model.Label, error) }
FormationTemplateService represents the FormationTemplate service layer
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is the FormationTemplate resolver
func NewResolver ¶
func NewResolver(transact persistence.Transactioner, converter FormationTemplateConverter, formationTemplateSvc FormationTemplateService, webhookConverter WebhookConverter, formationConstraintSvc FormationConstraintService, formationConstraintConverter FormationConstraintConverter) *Resolver
NewResolver creates FormationTemplate resolver
func (*Resolver) CreateFormationTemplate ¶
func (r *Resolver) CreateFormationTemplate(ctx context.Context, in graphql.FormationTemplateRegisterInput) (*graphql.FormationTemplate, error)
CreateFormationTemplate creates a FormationTemplate using `in`
func (*Resolver) DeleteFormationTemplate ¶
func (r *Resolver) DeleteFormationTemplate(ctx context.Context, id string) (*graphql.FormationTemplate, error)
DeleteFormationTemplate deletes the FormationTemplate matching ID `id`
func (*Resolver) DeleteFormationTemplateLabel ¶
func (r *Resolver) DeleteFormationTemplateLabel(ctx context.Context, formationTemplateID, key string) (*graphql.Label, error)
DeleteFormationTemplateLabel deletes a formation template label with the specified label key and formation template ID
func (*Resolver) FormationConstraint ¶
func (r *Resolver) FormationConstraint(ctx context.Context, obj *graphql.FormationTemplate) ([]*graphql.FormationConstraint, error)
FormationConstraint retrieves a FormationConstraint for the specified FormationTemplate
func (*Resolver) FormationConstraintsDataLoader ¶
func (r *Resolver) FormationConstraintsDataLoader(keys []dataloader.ParamFormationConstraint) ([][]*graphql.FormationConstraint, []error)
FormationConstraintsDataLoader retrieves Formation Constraints for each FormationTemplate ID in the keys
func (*Resolver) FormationTemplate ¶
func (r *Resolver) FormationTemplate(ctx context.Context, id string) (*graphql.FormationTemplate, error)
FormationTemplate queries the FormationTemplate matching ID `id`
func (*Resolver) FormationTemplates ¶
func (r *Resolver) FormationTemplates(ctx context.Context, filters []*graphql.LabelFilter, first *int, after *graphql.PageCursor) (*graphql.FormationTemplatePage, error)
FormationTemplates pagination lists all FormationTemplates based on `first` and `after`
func (*Resolver) FormationTemplatesByName ¶
func (r *Resolver) FormationTemplatesByName(ctx context.Context, name *string, first *int, after *graphql.PageCursor) (*graphql.FormationTemplatePage, error)
FormationTemplatesByName pagination lists all FormationTemplates filtered by name and based on `first` and `after`
func (*Resolver) Labels ¶
func (r *Resolver) Labels(ctx context.Context, obj *graphql.FormationTemplate, key *string) (graphql.Labels, error)
Labels retrieve all labels for formation template
func (*Resolver) SetFormationTemplateLabel ¶
func (r *Resolver) SetFormationTemplateLabel(ctx context.Context, formationTemplateID string, lblInput graphql.LabelInput) (*graphql.Label, error)
SetFormationTemplateLabel add the provided label key and value to a formation template with the specified ID. If the label does not exist, it will be created. In case the label is already present, it will be updated with the provided value.
func (*Resolver) UpdateFormationTemplate ¶
func (r *Resolver) UpdateFormationTemplate(ctx context.Context, id string, in graphql.FormationTemplateUpdateInput) (*graphql.FormationTemplate, error)
UpdateFormationTemplate updates the FormationTemplate matching ID `id` using `in`
type TenantService ¶
type TenantService interface {
ExtractTenantIDForTenantScopedFormationTemplates(ctx context.Context) (string, error)
}
TenantService is responsible for service-layer tenant operations
type UIDService ¶
type UIDService interface {
Generate() string
}
UIDService generates UUIDs for new entities
type WebhookConverter ¶
type WebhookConverter interface { MultipleToGraphQL(in []*model.Webhook) ([]*graphql.Webhook, error) MultipleInputFromGraphQL(in []*graphql.WebhookInput) ([]*model.WebhookInput, error) }
WebhookConverter converts between the graphql and model