Documentation
¶
Overview ¶
Package osvecosystem provides the Parsed type which represents an OSV ecosystem string.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parsed ¶
type Parsed struct {
Ecosystem osvconstants.Ecosystem
Suffix string
}
Parsed represents an ecosystem-with-suffix string as defined by the spec, parsed into a structured format.
The suffix is optional and is separated from the ecosystem by a colon.
For example, "Debian:7" would be parsed into Parsed{Ecosystem: constants.EcosystemDebian, Suffix: "7"}
func FromEcosystem ¶
func FromEcosystem(ecosystem osvconstants.Ecosystem) Parsed
FromEcosystem creates a Parsed struct from an osvschema.Ecosystem.
func MustParse ¶
MustParse parses a string into a constants.Ecosystem and an optional suffix specified with a ":" Panics if there is an invalid ecosystem
func Parse ¶
Parse parses a string into a constants.Ecosystem and an optional suffix specified with a ":"
func (Parsed) GetValidity ¶
GetValidity checks if the ecosystem is a valid OSV ecosystem value. Returns nil if valid, error otherwise.
func (Parsed) MarshalJSON ¶
MarshalJSON handles marshals a Parsed struct into a JSON string.
This method implements the json.Marshaler interface.
func (*Parsed) UnmarshalJSON ¶
UnmarshalJSON handles unmarshalls a JSON string into a Parsed struct.
This method implements the json.Unmarshaler interface.