Documentation ¶
Index ¶
- Constants
- type Ap
- type BuildExpression
- func (e *BuildExpression) Copy() (*BuildExpression, error)
- func (e *BuildExpression) MarshalJSON() ([]byte, error)
- func (e *BuildExpression) MaybeSetDefaultTimestamp(ts *strfmt.DateTime) error
- func (e *BuildExpression) Requirements() ([]model.Requirement, error)
- func (e *BuildExpression) SetDefaultTimestamp() error
- func (e *BuildExpression) UpdatePlatform(operation model.Operation, platformID strfmt.UUID) error
- func (e *BuildExpression) UpdateRequirement(operation model.Operation, requirement model.Requirement) error
- type In
- type Let
- type Null
- type RequirementNotFoundError
- type Value
- type Var
Constants ¶
const ( SolveFuncName = "solve" SolveLegacyFuncName = "solve_legacy" RequirementsKey = "requirements" PlatformsKey = "platforms" AtTimeKey = "at_time" RequirementNameKey = "name" RequirementNamespaceKey = "namespace" RequirementVersionRequirementsKey = "version_requirements" RequirementVersionKey = "version" RequirementRevisionKey = "revision" RequirementComparatorKey = "comparator" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ap ¶
func (*Ap) MarshalJSON ¶
type BuildExpression ¶
func New ¶
func New(data []byte) (*BuildExpression, error)
New creates a BuildExpression from a JSON byte array. The JSON must be a valid BuildExpression in the following format:
{ "let": { "runtime": { "solve_legacy": { "at_time": "$at_time", "build_flags": [], "camel_flags": [], "platforms": [ "96b7e6f2-bebf-564c-bc1c-f04482398f38" ], "requirements": [ { "name": "requests", "namespace": "language/python" }, { "name": "python", "namespace": "language", "version_requirements": [ { "comparator": "eq", "version": "3.10.10" } ] }, ], "solver_version": null } }, "in": "$runtime" } }
func NewEmpty ¶
func NewEmpty() (*BuildExpression, error)
NewEmpty creates a minimal, empty buildexpression.
func (*BuildExpression) Copy ¶
func (e *BuildExpression) Copy() (*BuildExpression, error)
func (*BuildExpression) MarshalJSON ¶
func (e *BuildExpression) MarshalJSON() ([]byte, error)
func (*BuildExpression) MaybeSetDefaultTimestamp ¶
func (e *BuildExpression) MaybeSetDefaultTimestamp(ts *strfmt.DateTime) error
MaybeSetDefaultTimestamp changes the solve node's "at_time" value to "$at_time" if and only if the current value is the given timestamp. Buildscripts prefer to use variables for at_time and define them outside the buildexpression as the expression's commit time. While modern buildexpressions use variables, older ones bake in the commit time. This function exists primarily to update those older buildexpressions for use in buildscripts.
func (*BuildExpression) Requirements ¶
func (e *BuildExpression) Requirements() ([]model.Requirement, error)
Requirements returns the requirements in the BuildExpression. It returns an error if the requirements are not found or if they are malformed. It expects the JSON representation of the solve node to be formatted as follows:
{ "requirements": [ { "name": "requests", "namespace": "language/python" }, { "name": "python", "namespace": "language", "version_requirements": [{ "comparator": "eq", "version": "3.10.10" }] } ] }
func (*BuildExpression) SetDefaultTimestamp ¶
func (e *BuildExpression) SetDefaultTimestamp() error
func (*BuildExpression) UpdatePlatform ¶
func (*BuildExpression) UpdateRequirement ¶
func (e *BuildExpression) UpdateRequirement(operation model.Operation, requirement model.Requirement) error
Update updates the BuildExpression's requirements based on the operation and requirement.
type In ¶
func (*In) MarshalJSON ¶
type Let ¶
type Let struct { // Let statements can be nested. // Each let will contain its own assignments and an in statement. Let *Let Assignments []*Var In *In }
func (*Let) MarshalJSON ¶
type RequirementNotFoundError ¶
type RequirementNotFoundError struct { Name string *locale.LocalizedError // for legacy non-user-facing error usages }