Documentation ¶
Index ¶
- Variables
- func Decode(typ reflect.Type, values map[string]string, prefix string, fn FieldName) interface{}
- func DecodeInto(obj interface{}, values map[string]string, prefix string, fn FieldName)
- func DeriveBomRef(p pkg.Package) string
- func Encode(obj interface{}, prefix string, fn FieldName) map[string]string
- func EncodeComponent(p pkg.Package) cyclonedx.Component
- func EncodeProperties(obj interface{}, prefix string) (out []cyclonedx.Property)
- func PtrToStruct(ptr interface{}) interface{}
- func ToSyftModel(bom *cyclonedx.BOM) (*sbom.SBOM, error)
- type FieldName
- type NameValue
Constants ¶
This section is empty.
Variables ¶
View Source
var (
CycloneDXFields = RequiredTag("cyclonedx")
)
View Source
var ( // OptionalJSONTag uses field names defined in json tags, if available OptionalJSONTag = TrimOmitempty(OptionalTag("json")) )
Functions ¶
func DecodeInto ¶
DecodeInto decodes all values to hydrate the given object instance
func DeriveBomRef ¶
func Encode ¶
Encode recursively encodes the object's properties as an ordered set of NameValue pairs
func EncodeComponent ¶
func EncodeProperties ¶
func EncodeProperties(obj interface{}, prefix string) (out []cyclonedx.Property)
func PtrToStruct ¶
func PtrToStruct(ptr interface{}) interface{}
func ToSyftModel ¶
Types ¶
type FieldName ¶
type FieldName func(field reflect.StructField) (string, bool)
FieldName return a flag to indicate this is a valid field and a name to use
func OptionalTag ¶
OptionalTag given a tag name, will return the defined tag or fall back to lower camel case field name
func RequiredTag ¶
RequiredTag based on the given tag, only use a field if present
func TrimOmitempty ¶
TrimOmitempty trims `,omitempty` from the name
Click to show internal directories.
Click to hide internal directories.