ecosystem

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ecosystem provides a parser and mappings for ecosystem strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parsed

type Parsed struct {
	Ecosystem osvschema.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 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

func (Parsed) IsEmpty

func (p Parsed) IsEmpty() bool

func (Parsed) IsValid added in v2.2.1

func (p Parsed) IsValid() bool

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