operations

package
v0.0.0-...-07345c1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateContractMetadataOp = cldfops.NewOperation(
	"catalog-create-contract-metadata",
	semver.MustParse("1.0.0"),
	"Add contract metadata entries to the Catalog service",
	func(b cldfops.Bundle, deps CreateContractMetadataDeps, input CreateContractMetadataInput) (CreateContractMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return CreateContractMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, item := range input.ContractMetadata {
			err = dataStore.ContractMetadata().Add(item)
			if err != nil {
				return CreateContractMetadataOutput{}, fmt.Errorf("failed to create contract metadata entry %d in catalog store: %w", i, err)
			}
		}

		b.Logger.Infow("Catalog ContractMetadata created successfully")

		return CreateContractMetadataOutput{DataStore: dataStore}, nil
	},
)

CreateContractMetadataOp creates contract metadata entries in the Catalog service.

Functions

This section is empty.

Types

type CreateContractMetadataDeps

type CreateContractMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

CreateContractMetadataDeps holds non-serializable dependencies for the CreateContractMetadataOp operation.

type CreateContractMetadataInput

type CreateContractMetadataInput struct {
	ContractMetadata []cldfdatastore.ContractMetadata
}

CreateContractMetadataInput is the serializable input of a CreateContractMetadataOp invocation.

type CreateContractMetadataOutput

type CreateContractMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

CreateContractMetadataOutput is the serializable output of a CreateContractMetadataOp invocation.

Jump to

Keyboard shortcuts

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