metautil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package metautil takes care of basic details of working with snap metadata formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeValue

func NormalizeValue(v interface{}) (interface{}, error)

NormalizeValue validates values and returns a normalized version of it (map[interface{}]interface{} is turned into map[string]interface{})

func SetValueFromAttribute

func SetValueFromAttribute(snapName string, ifaceName string, attrName string, attrVal interface{}, val interface{}) error

SetValueFromAttribute attempts to convert the attribute value read from the given snap/interface into the desired type.

The snapName, ifaceName and attrName are only used to produce contextual error messages, but are not otherwise significant. This function only operates converting the attrVal parameter into a value which can fit into the val parameter, which therefore must be a pointer.

Types

type AttributeNotCompatibleError

type AttributeNotCompatibleError struct {
	SnapName      string
	InterfaceName string
	AttributeName string
	AttributeType reflect.Type
	ExpectedType  reflect.Type
}

AttributeNotCompatibleError represents a type mismatch error between an interface attribute and an expected type.

func (AttributeNotCompatibleError) Error

func (AttributeNotCompatibleError) Is

func (e AttributeNotCompatibleError) Is(target error) bool

Jump to

Keyboard shortcuts

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