Documentation
¶
Overview ¶
Package asset provides utilities for managing and manipulating assets. It includes functionalities for JSON schema compilation, caching, and manipulation of JSON objects. It also provides utilities for handling concurrent operations on these assets.
The package uses the "github.com/santhosh-tekuri/jsonschema/v5" library for JSON schema compilation and validation. It uses the "github.com/zhchang/goquiver/safe" library for safe concurrent operations.
The package initializes a JSON schema compiler in the Draft4 mode and provides a function to remove empty required fields from a JSON object.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct {
// contains filtered or unexported fields
}
Asset represents an asset in the system. It contains information about the asset's ID, type, release, local path, URL, and associated JSON schema.
Fields: id: A unique identifier for the asset. typ: The type of the asset. release: The release version of the asset. localPath: The local file path where the asset is stored. url: The URL where the asset can be accessed. schema: The JSON schema associated with the asset, used for validation.
func New ¶
func New(rc global.AssetContext, typ, release string) (*Asset, error)
New creates a new Asset instance with the specified asset context, type, and release. It returns a pointer to the created Asset and an error, if any. The asset context (rc) must not be nil. The type (typ) and release must be non-empty strings. The function initializes the local path, URL, and ID of the asset. It also sets up a loader for the asset and performs necessary operations to populate the asset's local directory. Finally, it compiles the asset's schema using the specified schema file.