dao

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderLabelPrefix = "walrus.seal.io/provider-"
	LabelValueTrue      = "true"
)

Variables

View Source
var OrderSemverVersionFunc = func(s *sql.Selector) {
	s.OrderExprFunc(func(b *sql.Builder) {
		b.WriteString("CASE WHEN")
		b.Ident(templateversion.FieldVersion)
		b.WriteString(" ~ '" + semverExpression + "' THEN string_to_array(regexp_replace(")
		b.Ident(templateversion.FieldVersion)
		b.WriteString(", E'[^0-9\\.]+','', 'g'), '.', '')::int[] ELSE NULL END DESC")
	})
}

Functions

func CreateWorkflowExecution added in v0.4.0

func CreateWorkflowExecution(
	ctx context.Context,
	mc model.ClientSet,
	opts CreateWorkflowExecutionOptions,
) (*model.WorkflowExecution, error)

func CreateWorkflowStageExecution added in v0.4.0

func CreateWorkflowStageExecution(
	ctx context.Context,
	mc model.ClientSet,
	opts CreateWorkflowStageExecutionOptions,
) (*model.WorkflowStageExecution, error)

func CreateWorkflowStepExecution added in v0.4.0

func CreateWorkflowStepExecution(
	ctx context.Context,
	mc model.ClientSet,
	opts CreateWorkflowStepExecutionOptions,
) (*model.WorkflowStepExecution, error)

func EnvironmentConnectorsEdgeSave

func EnvironmentConnectorsEdgeSave(ctx context.Context, mc model.ClientSet, entity *model.Environment) error

EnvironmentConnectorsEdgeSave saves the edge connectors of model.Environment entity.

func EnvironmentVariablesEdgeSave added in v0.4.0

func EnvironmentVariablesEdgeSave(ctx context.Context, mc model.ClientSet, entity *model.Environment) error

EnvironmentVariablesEdgeSave saves the edge variables of model.Environment entity.

func ExposeResourceDefinition added in v0.4.0

func ExposeResourceDefinition(_rd *model.ResourceDefinition) *model.ResourceDefinitionOutput

ExposeResourceDefinition converts the ResourceDefinition to ResourceDefinitionOutput.

func ExposeResourceDefinitions added in v0.4.0

func ExposeResourceDefinitions(_rds []*model.ResourceDefinition) []*model.ResourceDefinitionOutput

ExposeResourceDefinitions converts the ResourceDefinition slice to ResourceDefinitionOutput pointer slice.

func GetCleanResourceComponents added in v0.5.1

func GetCleanResourceComponents(
	ctx context.Context,
	mc model.ClientSet,
	components model.ResourceComponents,
) (model.ResourceComponents, error)

GetCleanResourceComponents get the components that exist in the database. It is used to filter the components that do not exist in the database.

func GetConnectors added in v0.6.0

func GetConnectors(
	ctx context.Context,
	mc model.ClientSet,
	environmentID object.ID,
) (model.Connectors, error)

GetConnectors gets connectors of an environment.

func GetEnvironmentByID

func GetEnvironmentByID(ctx context.Context, mc model.ClientSet, id object.ID) (*model.Environment, error)

GetEnvironmentByID gets an environment including project & connectors edges by ID.

func GetEnvironmentsByIDs

func GetEnvironmentsByIDs(ctx context.Context, mc model.ClientSet, ids ...object.ID) ([]*model.Environment, error)

GetEnvironmentsByIDs gets environments including project & connectors edges by IDs.

func GetNonStoppedResourceDependantIDs added in v0.4.0

func GetNonStoppedResourceDependantIDs(
	ctx context.Context,
	mc model.ClientSet,
	resourceIDs ...object.ID,
) ([]object.ID, error)

GetNonStoppedResourceDependantIDs gets IDs of resources that depend on the given resources and is not in stopped status.

func GetPreviousRequiredProviders added in v0.6.0

func GetPreviousRequiredProviders(
	ctx context.Context,
	mc model.ClientSet,
	resourceID object.ID,
) ([]types.ProviderRequirement, error)

GetPreviousRequiredProviders get previous succeed run required providers. NB(alex): the previous run may be failed, the failed run may not contain required providers of states.

func GetRejectMessage added in v0.4.0

func GetRejectMessage(ctx context.Context, mc model.ClientSet, entity *model.WorkflowStepExecution) (string, error)

GetRejectMessage returns the reject message of the workflow approval step execution.

func GetResourceDependantIDs added in v0.4.0

func GetResourceDependantIDs(ctx context.Context, mc model.ClientSet, resourceIDs ...object.ID) ([]object.ID, error)

GetResourceDependantIDs gets IDs of resources that depend on the given resources.

func GetResourceDependantNames added in v0.4.0

func GetResourceDependantNames(
	ctx context.Context,
	modelClient model.ClientSet,
	entity *model.Resource,
	excludeStatus ...any,
) ([]string, error)

GetResourceDependantNames gets names of resources that depends on the given resource. ExcludeStatus is an optional string slice of dependant resource status to exclude.

func GetResourceDependantResource added in v0.5.0

func GetResourceDependantResource(
	ctx context.Context,
	mc model.ClientSet,
	resourceID object.ID,
) (model.Resources, error)

GetResourceDependantResource returns the resources that depend on the given resource.

func GetResourceDependencyResources added in v0.5.0

func GetResourceDependencyResources(
	ctx context.Context,
	mc model.ClientSet,
	resourceID object.ID,
) (model.Resources, error)

GetResourceDependencyResources returns the resources that the given resource depends on.

func GetResourceNamesByIDs added in v0.4.0

func GetResourceNamesByIDs(
	ctx context.Context,
	modelClient model.ClientSet,
	resourceIDs ...object.ID,
) ([]string, error)

func GetResourcesLatestRuns added in v0.6.0

func GetResourcesLatestRuns(
	ctx context.Context,
	modelClient model.ClientSet,
	resourceIDs ...object.ID,
) ([]*model.ResourceRun, error)

GetResourcesLatestRuns returns the latest runs of given resources ids.

func OverwriteWorkflowVariables added in v0.4.0

func OverwriteWorkflowVariables(vars map[string]string, config types.WorkflowVariables) (map[string]string, error)

OverwriteWorkflowVariables merges the variables into the config.

func ProjectSubjectRolesEdgeSave

func ProjectSubjectRolesEdgeSave(ctx context.Context, mc model.ClientSet, entity *model.Project) error

ProjectSubjectRolesEdgeSave saves the edge subject roles of model.Project entity.

func ResetWorkflowExecution added in v0.4.0

func ResetWorkflowExecution(ctx context.Context, mc model.ClientSet, workflowExecution *model.WorkflowExecution) error

ResetWorkflowExecution resets the workflow execution and add execution times by 1. The workflow execution will be reset when rerun the workflow execution.

func ResetWorkflowStageExecution added in v0.4.0

func ResetWorkflowStageExecution(
	ctx context.Context,
	mc model.ClientSet,
	stageExecution *model.WorkflowStageExecution,
) error

ResetWorkflowStageExecution resets the workflow stage execution and add execution times by 1. The workflow stage execution will be reset when rerun the workflow execution.

func ResetWorkflowStepExecution added in v0.4.0

func ResetWorkflowStepExecution(
	ctx context.Context,
	mc model.ClientSet,
	stepExecution *model.WorkflowStepExecution,
) error

ResetWorkflowStepExecution resets the workflow step execution and add execution times by 1. The workflow step execution will be reset when rerun the workflow execution.

func ResourceComponentGetUniqueKey added in v0.4.0

func ResourceComponentGetUniqueKey(r *model.ResourceComponent) string

ResourceComponentGetUniqueKey returns the unique index key of the given model.ResourceComponent.

func ResourceComponentInstancesEdgeSave added in v0.4.0

func ResourceComponentInstancesEdgeSave(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.ResourceComponent,
) error

ResourceComponentInstancesEdgeSave saves the edge instances of model.ResourceComponent entity.

func ResourceComponentInstancesEdgeSaveWithResult added in v0.4.1

func ResourceComponentInstancesEdgeSaveWithResult(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.ResourceComponent,
) ([]*model.ResourceComponent, error)

ResourceComponentInstancesEdgeSaveWithResult saves the edge instances of model.ResourceComponent entity and return new created components.

func ResourceComponentRelationshipUpdateWithDependencies added in v0.4.0

func ResourceComponentRelationshipUpdateWithDependencies(
	ctx context.Context,
	mc model.ClientSet,
	dependencies map[string][]string,
	recordComponents,
	createComponents model.ResourceComponents,
) error

ResourceComponentRelationshipUpdateWithDependencies updates the dependencies of resource components with dependencies. Update relationships between resource components dependencies, relationship like composition or realization will be ignored.

func ResourceComponentShapeClassQuery added in v0.4.0

func ResourceComponentShapeClassQuery(query *model.ResourceComponentQuery) *model.ResourceComponentQuery

ResourceComponentShapeClassQuery wraps the given model.ResourceComponent query to select all shape class resources and the owned components and dependencies of them.

func ResourceComponentToMap added in v0.4.0

func ResourceComponentToMap(resources []*model.ResourceComponent) map[string]*model.ResourceComponent

ResourceComponentToMap recursive set a map of resource components indexed by its unique index.

func ResourceDefinitionMatchingRulesEdgeSave added in v0.4.0

func ResourceDefinitionMatchingRulesEdgeSave(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.ResourceDefinition,
) error

ResourceDefinitionMatchingRulesEdgeSave saves the edge matching rules of model.ResourceDefinition entity.

func ResourceDependenciesEdgeSave added in v0.4.0

func ResourceDependenciesEdgeSave(ctx context.Context, mc model.ClientSet, entity *model.Resource) error

ResourceDependenciesEdgeSave saves the edge dependencies of model.Resource entity.

func ResourceRelationshipCheckCycle added in v0.4.0

func ResourceRelationshipCheckCycle(s *model.ResourceRelationship) bool

ResourceRelationshipCheckCycle checks if the path contains a dependency cycle.

func ResourceRelationshipGetDependencyNames added in v0.4.0

func ResourceRelationshipGetDependencyNames(entity *model.Resource) []string

ResourceRelationshipGetDependencyNames gets dependency resource names of the given resource.

func SubjectRolesEdgeSave

func SubjectRolesEdgeSave(ctx context.Context, mc model.ClientSet, entity *model.Subject) error

SubjectRolesEdgeSave saves the global scope edge roles of model.Subject entity, the roles must not have project id.

func WorkflowStageStepsEdgeSave added in v0.4.0

func WorkflowStageStepsEdgeSave(ctx context.Context, mc model.ClientSet, entity *model.WorkflowStage) error

WorkflowStageStepsEdgeSave saves the edge steps of model.WorkflowStage entity.

func WorkflowStagesEdgeSave added in v0.4.0

func WorkflowStagesEdgeSave(ctx context.Context, mc model.ClientSet, entity *model.Workflow) error

Types

type CreateWorkflowExecutionOptions added in v0.4.0

type CreateWorkflowExecutionOptions struct {
	Workflow *model.Workflow
	// Execution parameters that replace workflow variables config value.
	Variables map[string]string
	// Description is the description of the workflow execution.
	Description string
}

type CreateWorkflowStageExecutionOptions added in v0.4.0

type CreateWorkflowStageExecutionOptions struct {
	CreateWorkflowExecutionOptions `json:",inline"`

	WorkflowExecution *model.WorkflowExecution
	Stage             *model.WorkflowStage
}

type CreateWorkflowStepExecutionOptions added in v0.4.0

type CreateWorkflowStepExecutionOptions struct {
	CreateWorkflowExecutionOptions `json:",inline"`

	StageExecution *model.WorkflowStageExecution
	Step           *model.WorkflowStep
}

Jump to

Keyboard shortcuts

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