buildexpression

package
v0.0.0-...-7426b64 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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

type Ap struct {
	Name      string
	Arguments []*Value
}

func (*Ap) MarshalJSON

func (f *Ap) MarshalJSON() ([]byte, error)

type BuildExpression

type BuildExpression struct {
	Let         *Let
	Assignments []*Value
}

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 (e *BuildExpression) UpdatePlatform(operation model.Operation, platformID strfmt.UUID) error

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

type In struct {
	FuncCall *Ap
	Name     *string
}

func (*In) MarshalJSON

func (i *In) MarshalJSON() ([]byte, error)

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

func (l *Let) MarshalJSON() ([]byte, error)

type Null

type Null struct {
	Null string
}

type RequirementNotFoundError

type RequirementNotFoundError struct {
	Name                   string
	*locale.LocalizedError // for legacy non-user-facing error usages
}

type Value

type Value struct {
	Ap    *Ap
	List  *[]*Value
	Str   *string
	Null  *Null
	Float *float64
	Int   *int

	Assignment *Var
	Object     *[]*Var
	Ident      *string
}

func (*Value) MarshalJSON

func (v *Value) MarshalJSON() ([]byte, error)

type Var

type Var struct {
	Name  string
	Value *Value
}

func (*Var) MarshalJSON

func (a *Var) MarshalJSON() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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