elements

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Overview

Package elements has wrappers of the protobom elements (from the main protobuf definition) that implement the ref.Val interface used by the CEL runtime. This lets the library expose them natively in the CEL evaluation environment.

As of v0.1.0 the elements package has a complete wrappers library for the native elements defined in protobom v0.5.x.

Index

Constants

This section is empty.

Variables

View Source
var (
	NodeObject = decls.NewObjectType("protobom.protobom.Node")
	NodeType   = cel.ObjectType("protobom.protobom.Node")
)
View Source
var (
	NodeListObject = decls.NewObjectType("protobom.protobom.NodeList")
	NodeListType   = cel.ObjectType("protobom.protobom.NodeList")
)
View Source
var (
	PersonObject = decls.NewObjectType("protobom.protobom.Person")
	PersonType   = cel.ObjectType("protobom.protobom.Person")
)
View Source
var (
	ProtobomObject = decls.NewObjectType("protobom")
	ProtobomType   = cel.ObjectType("protobom", traits.ReceiverType)
)
View Source
var DocumentType = cel.ObjectType("protobom.protobom.Document")
View Source
var EdgeType = cel.ObjectType("protobom.protobom.Edge")
View Source
var ExternalReferenceType = cel.ObjectType("protobom.protobom.ExternalReference")
View Source
var MetadataType = cel.ObjectType("protobom.protobom.Metadata")
View Source
var PropertyType = cel.ObjectType("protobom.protobom.Property")
View Source
var SourceDataType = cel.ObjectType("protobom.protobom.SourceData")
View Source
var ToolType = cel.ObjectType("protobom.protobom.Tool")

Functions

This section is empty.

Types

type Document

type Document struct {
	*sbom.Document
}

func (*Document) ConvertToNative

func (d *Document) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*Document) ConvertToType

func (d *Document) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Document) Equal

func (*Document) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*Document) Get

func (d *Document) Get(index ref.Val) ref.Val

Get is the getter to implement the indexer trait

func (*Document) Type

func (*Document) Type() ref.Type

func (*Document) Value

func (d *Document) Value() any

Value implements ref.Val.Value.

type Edge

type Edge struct {
	*sbom.Edge
}

func (*Edge) ConvertToNative

func (e *Edge) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*Edge) ConvertToType

func (e *Edge) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Edge) Equal

func (e *Edge) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*Edge) Get

func (e *Edge) Get(index ref.Val) ref.Val

Get is the getter to implement the indexer trait

func (*Edge) Type

func (*Edge) Type() ref.Type

func (*Edge) Value

func (e *Edge) Value() any

Value implements ref.Val.Value.

type ExternalReference

type ExternalReference struct {
	*sbom.ExternalReference
}

func (*ExternalReference) ConvertToNative

func (er *ExternalReference) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*ExternalReference) ConvertToType

func (er *ExternalReference) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*ExternalReference) Equal

func (er *ExternalReference) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*ExternalReference) Get

func (er *ExternalReference) Get(index ref.Val) ref.Val

Get is the getter to implement the indexer trait

func (*ExternalReference) Type

func (*ExternalReference) Type() ref.Type

func (*ExternalReference) Value

func (er *ExternalReference) Value() any

Value implements ref.Val.Value.

type Metadata

type Metadata struct {
	*sbom.Metadata
}

func (*Metadata) ConvertToNative

func (md *Metadata) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*Metadata) ConvertToType

func (md *Metadata) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Metadata) Equal

func (*Metadata) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*Metadata) Get

func (md *Metadata) Get(index ref.Val) ref.Val

func (*Metadata) Type

func (*Metadata) Type() ref.Type

func (*Metadata) Value

func (md *Metadata) Value() any

Value implements ref.Val.Value.

type Node

type Node struct {
	*sbom.Node
}

func (*Node) ConvertToNative

func (n *Node) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*Node) ConvertToType

func (n *Node) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Node) Equal

func (n *Node) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*Node) Get

func (n *Node) Get(index ref.Val) ref.Val

func (*Node) ToNodeList

func (n *Node) ToNodeList() *NodeList

ToNodeList returns a new NodeList with the node as the only member

func (*Node) Type

func (*Node) Type() ref.Type

func (*Node) Value

func (n *Node) Value() any

Value implements ref.Val.Value.

type NodeList

type NodeList struct {
	*sbom.NodeList
}

func (*NodeList) Add

func (nl *NodeList) Add(incoming ref.Val)

Add should at least merge two nodelists together.

func (*NodeList) AddEdge

func (nl *NodeList) AddEdge(from string, t sbom.Edge_Type, to []string)

AddEsge adds edge data to

func (*NodeList) ConvertToNative

func (nl *NodeList) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*NodeList) ConvertToType

func (nl *NodeList) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*NodeList) Equal

func (nl *NodeList) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*NodeList) Get

func (nl *NodeList) Get(index ref.Val) ref.Val

func (*NodeList) HasNodeWithID

func (nl *NodeList) HasNodeWithID(nodeID string) bool

HasNodeWithID Returns true if the NodeList already has a node with the specified ID

func (*NodeList) Type

func (*NodeList) Type() ref.Type

Type implements ref.Val.Type.

func (*NodeList) Value

func (nl *NodeList) Value() any

Value implements ref.Val.Value.

type Person

type Person struct {
	*sbom.Person
}

func (*Person) ConvertToNative

func (p *Person) ConvertToNative(typeDesc reflect.Type) (any, error)

func (*Person) ConvertToType

func (p *Person) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Person) Equal

func (p *Person) Equal(other ref.Val) ref.Val

func (*Person) Get

func (p *Person) Get(index ref.Val) ref.Val

Get is the getter to implement the indexer trait

func (*Person) Type

func (*Person) Type() ref.Type

func (*Person) Value

func (p *Person) Value() any

Value implements ref.Val.Value.

type Property

type Property struct {
	*sbom.Property
}

func (*Property) ConvertToNative

func (p *Property) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*Property) ConvertToType

func (p *Property) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Property) Equal

func (p *Property) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*Property) Get

func (p *Property) Get(index ref.Val) ref.Val

Get is the getter to implement the indexer trait

func (*Property) Type

func (*Property) Type() ref.Type

func (*Property) Value

func (p *Property) Value() any

Value implements ref.Val.Value.

type Protobom

type Protobom struct{}

Protobom is a global object that the CEL integration exposes in the environment this object groups some of the SBOM utility functions that are not methods of the protobom elements.

func (*Protobom) ConvertToNative

func (*Protobom) ConvertToNative(reflect.Type) (any, error)

func (*Protobom) ConvertToType

func (*Protobom) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Protobom) Equal

func (*Protobom) Equal(ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*Protobom) Type

func (*Protobom) Type() ref.Type

func (*Protobom) Value

func (p *Protobom) Value() any

Value implements ref.Val.Value.

type SourceData

type SourceData struct {
	*sbom.SourceData
}

func (*SourceData) ConvertToNative

func (sd *SourceData) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*SourceData) ConvertToType

func (sd *SourceData) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*SourceData) Equal

func (sd *SourceData) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*SourceData) Get

func (sd *SourceData) Get(index ref.Val) ref.Val

Get is the getter to implement the indexer trait

func (*SourceData) Type

func (*SourceData) Type() ref.Type

func (*SourceData) Value

func (sd *SourceData) Value() any

Value implements ref.Val.Value.

type Tool

type Tool struct {
	*sbom.Tool
}

func (*Tool) ConvertToNative

func (t *Tool) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (*Tool) ConvertToType

func (t *Tool) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (*Tool) Equal

func (t *Tool) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (*Tool) Get

func (t *Tool) Get(index ref.Val) ref.Val

Get is the getter to implement the indexer trait

func (*Tool) Type

func (*Tool) Type() ref.Type

func (*Tool) Value

func (t *Tool) Value() any

Value implements ref.Val.Value.

Jump to

Keyboard shortcuts

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