Documentation
¶
Overview ¶
Copyright 2023-2024 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Copyright 2024 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Index ¶
- Variables
- func TypeChoiceValueMarshalJSON(v ITypeChoiceValue) ([]byte, error)
- type Collection
- func (o *Collection[P, I]) Add(p *P) *Collection[P, I]
- func (o *Collection[P, I]) Clear()
- func (o *Collection[P, I]) GetExtensions() IMapValue
- func (o Collection[P, I]) IsEmpty() bool
- func (o Collection[P, I]) MarshalCBOR() ([]byte, error)
- func (o Collection[P, I]) MarshalJSON() ([]byte, error)
- func (o *Collection[P, I]) RegisterExtensions(exts Map) error
- func (o *Collection[P, I]) UnmarshalCBOR(data []byte) error
- func (o *Collection[P, I]) UnmarshalJSON(data []byte) error
- func (o Collection[P, I]) Valid() error
- type Extensions
- func (o *Extensions) Get(name string) (any, error)
- func (o *Extensions) GetBool(name string) (bool, error)
- func (o *Extensions) GetFloat32(name string) (float32, error)
- func (o *Extensions) GetFloat64(name string) (float64, error)
- func (o *Extensions) GetInt(name string) (int, error)
- func (o *Extensions) GetInt8(name string) (int8, error)
- func (o *Extensions) GetInt16(name string) (int16, error)
- func (o *Extensions) GetInt32(name string) (int32, error)
- func (o *Extensions) GetInt64(name string) (int64, error)
- func (o *Extensions) GetIntSlice(name string) ([]int, error)
- func (o *Extensions) GetSlice(name string) ([]any, error)
- func (o *Extensions) GetString(name string) (string, error)
- func (o *Extensions) GetStringMap(name string) (map[string]any, error)
- func (o *Extensions) GetStringMapString(name string) (map[string]string, error)
- func (o *Extensions) GetStringSlice(name string) ([]string, error)
- func (o *Extensions) GetUint(name string) (uint, error)
- func (o *Extensions) GetUint8(name string) (uint8, error)
- func (o *Extensions) GetUint16(name string) (uint16, error)
- func (o *Extensions) GetUint32(name string) (uint32, error)
- func (o *Extensions) GetUint64(name string) (uint64, error)
- func (o *Extensions) HaveExtensions() bool
- func (o *Extensions) IsEmpty() bool
- func (o *Extensions) MustGetBool(name string) bool
- func (o *Extensions) MustGetFloat32(name string) float32
- func (o *Extensions) MustGetFloat64(name string) float64
- func (o *Extensions) MustGetInt(name string) int
- func (o *Extensions) MustGetInt8(name string) int8
- func (o *Extensions) MustGetInt16(name string) int16
- func (o *Extensions) MustGetInt32(name string) int32
- func (o *Extensions) MustGetInt64(name string) int64
- func (o *Extensions) MustGetIntSlice(name string) []int
- func (o *Extensions) MustGetSlice(name string) []any
- func (o *Extensions) MustGetString(name string) string
- func (o *Extensions) MustGetStringMap(name string) map[string]any
- func (o *Extensions) MustGetStringMapString(name string) map[string]string
- func (o *Extensions) MustGetStringSlice(name string) []string
- func (o *Extensions) MustGetUint(name string) uint
- func (o *Extensions) MustGetUint8(name string) uint8
- func (o *Extensions) MustGetUint16(name string) uint16
- func (o *Extensions) MustGetUint32(name string) uint32
- func (o *Extensions) MustGetUint64(name string) uint64
- func (o Extensions) New() IMapValue
- func (o *Extensions) Register(exts IMapValue)
- func (o *Extensions) Set(name string, value any) error
- type IExtensible
- type IMapValue
- type ITypeChoiceValue
- type Map
- type Point
Constants ¶
This section is empty.
Variables ¶
var ErrExtensionNotFound = errors.New("extension not found")
var ErrUnexpectedPoint = errors.New("unexpected extension point")
var StringType = "string"
Functions ¶
func TypeChoiceValueMarshalJSON ¶
func TypeChoiceValueMarshalJSON(v ITypeChoiceValue) ([]byte, error)
Types ¶
type Collection ¶ added in v1.6.2
type Collection[P any, I IExtensible[P]] struct { Values []P // contains filtered or unexported fields }
Collection is a generic container for objects who's pointers implement IExtensible. In addition of containing instances of extensible objects, it is capable of registering extensions for those instances.
func NewCollection ¶ added in v1.6.2
func NewCollection[P any, I IExtensible[P]]() *Collection[P, I]
NewCollection returns a pointer to a new Collections instance.
func (*Collection[P, I]) Add ¶ added in v1.6.2
func (o *Collection[P, I]) Add(p *P) *Collection[P, I]
Add a new element to the collection.
func (*Collection[P, I]) Clear ¶ added in v1.6.2
func (o *Collection[P, I]) Clear()
Clear empties the collection of its values. This does _not_ unregister extensions.
func (*Collection[P, I]) GetExtensions ¶ added in v1.6.2
func (o *Collection[P, I]) GetExtensions() IMapValue
GetExtensions returns the extensions IMapValue that has been registered with the collection.
func (Collection[P, I]) IsEmpty ¶ added in v1.6.2
func (o Collection[P, I]) IsEmpty() bool
IsEmpty return true if the collection is empty, i.e. if it does not contain any values. This does not indicate whether or not any extensions have been registered with the collection.
func (Collection[P, I]) MarshalCBOR ¶ added in v1.6.2
func (o Collection[P, I]) MarshalCBOR() ([]byte, error)
func (Collection[P, I]) MarshalJSON ¶ added in v1.6.2
func (o Collection[P, I]) MarshalJSON() ([]byte, error)
func (*Collection[P, I]) RegisterExtensions ¶ added in v1.6.2
func (o *Collection[P, I]) RegisterExtensions(exts Map) error
RegisterExtensions register extensions for the collection's values. An error is returned if the provided map contains extension points not supported by the collection's values.
func (*Collection[P, I]) UnmarshalCBOR ¶ added in v1.6.2
func (o *Collection[P, I]) UnmarshalCBOR(data []byte) error
func (*Collection[P, I]) UnmarshalJSON ¶ added in v1.6.2
func (o *Collection[P, I]) UnmarshalJSON(data []byte) error
func (Collection[P, I]) Valid ¶ added in v1.6.2
func (o Collection[P, I]) Valid() error
Valid returns an error if the collection is invalid, i.e. if it is empty or if any of its contents are invalid.
type Extensions ¶
type Extensions struct {
IMapValue `json:"extensions,omitempty"`
}
func (*Extensions) GetFloat32 ¶
func (o *Extensions) GetFloat32(name string) (float32, error)
func (*Extensions) GetFloat64 ¶
func (o *Extensions) GetFloat64(name string) (float64, error)
func (*Extensions) GetIntSlice ¶
func (o *Extensions) GetIntSlice(name string) ([]int, error)
func (*Extensions) GetStringMap ¶
func (o *Extensions) GetStringMap(name string) (map[string]any, error)
func (*Extensions) GetStringMapString ¶
func (o *Extensions) GetStringMapString(name string) (map[string]string, error)
func (*Extensions) GetStringSlice ¶
func (o *Extensions) GetStringSlice(name string) ([]string, error)
func (*Extensions) HaveExtensions ¶
func (o *Extensions) HaveExtensions() bool
func (*Extensions) IsEmpty ¶ added in v1.6.2
func (o *Extensions) IsEmpty() bool
func (*Extensions) MustGetBool ¶
func (o *Extensions) MustGetBool(name string) bool
func (*Extensions) MustGetFloat32 ¶
func (o *Extensions) MustGetFloat32(name string) float32
func (*Extensions) MustGetFloat64 ¶
func (o *Extensions) MustGetFloat64(name string) float64
func (*Extensions) MustGetInt ¶
func (o *Extensions) MustGetInt(name string) int
func (*Extensions) MustGetInt8 ¶
func (o *Extensions) MustGetInt8(name string) int8
func (*Extensions) MustGetInt16 ¶
func (o *Extensions) MustGetInt16(name string) int16
func (*Extensions) MustGetInt32 ¶
func (o *Extensions) MustGetInt32(name string) int32
func (*Extensions) MustGetInt64 ¶
func (o *Extensions) MustGetInt64(name string) int64
func (*Extensions) MustGetIntSlice ¶
func (o *Extensions) MustGetIntSlice(name string) []int
func (*Extensions) MustGetSlice ¶
func (o *Extensions) MustGetSlice(name string) []any
func (*Extensions) MustGetString ¶
func (o *Extensions) MustGetString(name string) string
func (*Extensions) MustGetStringMap ¶
func (o *Extensions) MustGetStringMap(name string) map[string]any
func (*Extensions) MustGetStringMapString ¶
func (o *Extensions) MustGetStringMapString(name string) map[string]string
func (*Extensions) MustGetStringSlice ¶
func (o *Extensions) MustGetStringSlice(name string) []string
func (*Extensions) MustGetUint ¶
func (o *Extensions) MustGetUint(name string) uint
func (*Extensions) MustGetUint8 ¶
func (o *Extensions) MustGetUint8(name string) uint8
func (*Extensions) MustGetUint16 ¶
func (o *Extensions) MustGetUint16(name string) uint16
func (*Extensions) MustGetUint32 ¶
func (o *Extensions) MustGetUint32(name string) uint32
func (*Extensions) MustGetUint64 ¶
func (o *Extensions) MustGetUint64(name string) uint64
func (Extensions) New ¶ added in v1.6.2
func (o Extensions) New() IMapValue
func (*Extensions) Register ¶
func (o *Extensions) Register(exts IMapValue)
type IExtensible ¶ added in v1.6.2
type IExtensible[P any] interface { RegisterExtensions(exts Map) error GetExtensions() IMapValue Valid() error *P // this interface must be implemented by a pointer to P }
IExtensible defines an interface for extensible objects (those that can register extensions.
type ITypeChoiceValue ¶
type ITypeChoiceValue interface {
// String returns the string representation of the ITypeChoiceValue.
String() string
// Valid returns an error if validation of the ITypeChoiceValue fails,
// or nil if it succeeds.
Valid() error
// Type returns the type name of this ITypeChoiceValue implementation.
Type() string
}
ITypeChoiceValue is the interface that is implemented by all concrete type choice value types. Specific type choices define their own value interfaces that embed this one (and possibly include additional methods).
