Documentation ¶
Index ¶
- func RegisterFunctionMarshaler(name string, marshalJSON MarshalerFunc)
- func RegisterFunctionPreUnmarshaler(name string, preUnmarshal PreUnmarshalerFunc)
- type Assignment
- type BuildScript
- func (b *BuildScript) AtTime() *time.Time
- func (b *BuildScript) Clone() (*BuildScript, error)
- func (b *BuildScript) Equals(other *BuildScript) (bool, error)
- func (b *BuildScript) Marshal() ([]byte, error)
- func (b *BuildScript) MarshalBuildExpression() ([]byte, error)
- func (b *BuildScript) MarshalJSON() ([]byte, error)
- func (b *BuildScript) Merge(other *BuildScript, strategies *mono_models.MergeStrategies) error
- func (b *BuildScript) Platforms() ([]strfmt.UUID, error)
- func (b *BuildScript) Requirements() ([]Requirement, error)
- func (b *BuildScript) SetAtTime(t time.Time)
- func (b *BuildScript) UpdatePlatform(operation types.Operation, platformID strfmt.UUID) error
- func (b *BuildScript) UpdateRequirement(operation types.Operation, requirement types.Requirement) error
- type DependencyRequirement
- type FuncCall
- type MarshalerFunc
- type Null
- type PlatformNotFoundError
- type PreUnmarshalerFunc
- type Requirement
- type RequirementNotFoundError
- type RevisionRequirement
- type UnknownRequirement
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterFunctionMarshaler ¶
func RegisterFunctionMarshaler(name string, marshalJSON MarshalerFunc)
RegisterFunctionMarshaler registers a buildexpression marshaler for a buildscript function. Marshalers accept a buildscript Value, and marshals it to buildexpression JSON (e.g. an object).
func RegisterFunctionPreUnmarshaler ¶
func RegisterFunctionPreUnmarshaler(name string, preUnmarshal PreUnmarshalerFunc)
RegisterFunctionPreUnmarshaler registers a buildscript pre-unmarshaler for a buildexpression function. Pre-unmarshalers accept a JSON object of function arguments, transform those arguments as necessary, and return a JSON object for final unmarshaling to buildscript.
Types ¶
type Assignment ¶
func (*Assignment) MarshalJSON ¶
func (a *Assignment) MarshalJSON() ([]byte, error)
type BuildScript ¶
type BuildScript struct {
// contains filtered or unexported fields
}
BuildScript is what we want consuming code to work with. This specifically makes the raw presentation private as no consuming code should ever be looking at the raw representation. Instead this package should facilitate the use-case of the consuming code through convenience methods that are easy to understand and work with.
func New ¶
func New() (*BuildScript, error)
func Unmarshal ¶
func Unmarshal(data []byte) (*BuildScript, error)
Unmarshal returns a structured form of the given AScript (on-disk format).
func UnmarshalBuildExpression ¶
func UnmarshalBuildExpression(data []byte, atTime *time.Time) (*BuildScript, error)
UnmarshalBuildExpression returns a BuildScript constructed from the given build expression in JSON format. Build scripts and build expressions are almost identical, with the exception of the atTime field. Build expressions ALWAYS set at_time to `$at_time`, which refers to the timestamp on the commit, while buildscripts encode this timestamp as part of their definition. For this reason we have to supply the timestamp as a separate argument.
func (*BuildScript) AtTime ¶
func (b *BuildScript) AtTime() *time.Time
func (*BuildScript) Clone ¶
func (b *BuildScript) Clone() (*BuildScript, error)
func (*BuildScript) Equals ¶
func (b *BuildScript) Equals(other *BuildScript) (bool, error)
func (*BuildScript) Marshal ¶
func (b *BuildScript) Marshal() ([]byte, error)
Marshal returns this structure in AScript, suitable for writing to disk.
func (*BuildScript) MarshalBuildExpression ¶
func (b *BuildScript) MarshalBuildExpression() ([]byte, error)
MarshalJSON returns this structure as a build expression in JSON format, suitable for sending to the Platform.
func (*BuildScript) MarshalJSON ¶
func (b *BuildScript) MarshalJSON() ([]byte, error)
MarshalJSON returns this structure as a build expression in JSON format, suitable for sending to the Platform.
func (*BuildScript) Merge ¶
func (b *BuildScript) Merge(other *BuildScript, strategies *mono_models.MergeStrategies) error
Merge merges the requirements from another BuildScript into this one, according to the given merge strategy. BuildScript merges are only possible if the scripts differ ONLY in requirements AND/OR at times.
func (*BuildScript) Requirements ¶
func (b *BuildScript) Requirements() ([]Requirement, error)
func (*BuildScript) SetAtTime ¶
func (b *BuildScript) SetAtTime(t time.Time)
func (*BuildScript) UpdatePlatform ¶
func (*BuildScript) UpdateRequirement ¶
func (b *BuildScript) UpdateRequirement(operation types.Operation, requirement types.Requirement) error
type DependencyRequirement ¶
type DependencyRequirement struct {
types.Requirement
}
func (DependencyRequirement) IsRequirement ¶
func (r DependencyRequirement) IsRequirement()
type FuncCall ¶
type FuncCall struct { Name string `parser:"@Ident"` Arguments []*Value `parser:"'(' @@ (',' @@)* ','? ')'"` }
func (*FuncCall) MarshalJSON ¶
type MarshalerFunc ¶
type PlatformNotFoundError ¶
type PlatformNotFoundError struct { Id strfmt.UUID *locale.LocalizedError // for legacy non-user-facing error usages }
type PreUnmarshalerFunc ¶
type Requirement ¶
type Requirement interface {
IsRequirement()
}
type RequirementNotFoundError ¶
type RequirementNotFoundError struct { Name string *locale.LocalizedError // for legacy non-user-facing error usages }
type RevisionRequirement ¶
type RevisionRequirement struct { Name string `json:"name"` RevisionID strfmt.UUID `json:"revision_id"` }
func (RevisionRequirement) IsRequirement ¶
func (r RevisionRequirement) IsRequirement()
type UnknownRequirement ¶
func (UnknownRequirement) IsRequirement ¶
func (r UnknownRequirement) IsRequirement()
type Value ¶
type Value struct { FuncCall *FuncCall `parser:"@@"` List *[]*Value `parser:"| '[' (@@ (',' @@)* ','?)? ']'"` Str *string `parser:"| @String"` // note: this value is ALWAYS quoted Number *float64 `parser:"| (@Float | @Int)"` Null *Null `parser:"| @@"` Assignment *Assignment `parser:"| @@"` // only in FuncCall Object *[]*Assignment `parser:"| '{' @@ (',' @@)* ','? '}'"` // only in List Ident *string `parser:"| @Ident"` // only in FuncCall or Assignment }