Documentation ¶
Overview ¶
Package cpe provides for handling Common Platform Enumeration (CPE) names.
Index ¶
- Constants
- Variables
- type Attribute
- type Value
- type ValueKind
- type WFN
- func (w WFN) BindFS() string
- func (w WFN) GoString() string
- func (w *WFN) MarshalText() ([]byte, error)
- func (w *WFN) Scan(src interface{}) (err error)
- func (w WFN) String() string
- func (w *WFN) UnmarshalText(b []byte) (err error)
- func (w WFN) Valid() error
- func (w *WFN) Value() (driver.Value, error)
Constants ¶
const NumAttr = 11
NumAttr is the number of attributes in a 2.3 WFN.
Variables ¶
var ErrUnset = errors.New("cpe: wfn is empty")
ErrUnset is returned from (WFN).Valid() if it is the zero value.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute int
Attribute is a type for enumerating the valid CPE attributes.
type Value ¶
Value represents all the states for an attribute's value.
func NewValue ¶
NewValue constructs a specific value and ensures it's a valid string.
This function does not quote the provided string, only validates that the quoting is proper.
func (*Value) GoString ¶ added in v1.1.0
GoString implements fmt.GoStringer.
type ValueKind ¶
type ValueKind uint
ValueKind indicates what "kind" a value is.
These are the valid states for a wfn attribute's value.
type WFN ¶
WFN is a well-formed name as defined by the Common Platform Enumeration (CPE) spec: https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7695.pdf
This package does not implement binding into URI form.
func MustUnbind ¶
MustUnbind calls Unbind on the provided string, but panics if any errors are encountered.
This is primarily useful for static data where any error is a programmer error.
func UnbindURI ¶
UnbindURI attempts to unbind a string as CPE 2.2 URI into a WFN.
This function supports unpacking attributes from the "edition" component as specified in CPE 2.3.
func (WFN) GoString ¶ added in v1.1.0
GoString implements fmt.GoStringer.
func (*WFN) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*WFN) Scan ¶ added in v1.1.0
Scan implements [sql.Scanner].
Passing an empty string does not error and leaves the WFN in its current state.
func (*WFN) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.