osvecosystem

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 4 Imported by: 1

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

func MustParse(str string) Parsed

MustParse parses a string into a constants.Ecosystem and an optional suffix specified with a ":" Panics if there is an invalid ecosystem

func Parse

func Parse(str string) (Parsed, error)

Parse parses a string into a constants.Ecosystem and an optional suffix specified with a ":"

func (Parsed) Equal

func (p Parsed) Equal(other Parsed) bool

Equal returns true if the two Parsed structs are equal.

func (Parsed) GetValidity

func (p Parsed) GetValidity() error

GetValidity checks if the ecosystem is a valid OSV ecosystem value. Returns nil if valid, error otherwise.

func (Parsed) IsEmpty

func (p Parsed) IsEmpty() bool

IsEmpty returns true if the Ecosystem struct is empty.

func (Parsed) MarshalJSON

func (p Parsed) MarshalJSON() ([]byte, error)

MarshalJSON handles marshals a Parsed struct into a JSON string.

This method implements the json.Marshaler interface.

func (Parsed) String

func (p Parsed) String() string

func (*Parsed) UnmarshalJSON

func (p *Parsed) UnmarshalJSON(data []byte) error

UnmarshalJSON handles unmarshalls a JSON string into a Parsed struct.

This method implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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