func NewIntLabel(value int) Label {
	return Label{intValue: value, isInt: true}
}
NewIntLabel creates a new Label from the specified int value.
package common
import (
	"encoding/json"
	"fmt"
	"strconv"
)
type Label struct {
	intValue int
	strValue string
	isInt    bool
}
func (l Label) Value() interface{} {
	if l.isInt {
		return l.intValue
	}
	return l.strValue
}
func (l Label) IsInt() bool {
	return l.isInt
}
func (l Label) AsInt() (int, error) {
	if l.isInt {
		return l.intValue, nil
	}
	return -1, fmt.Errorf("label value not an integer")
}
func (l Label) String() string {
	if l.isInt {
		return fmt.Sprint(l.intValue)
	}
	return l.strValue
}
func (l *Label) FromString(text string) {
	intVal, err := strconv.Atoi(text)
	if err == nil {
		l.intValue = intVal
		l.isInt = true
	} else {
		l.strValue = text
		l.isInt = false
	}
}
func (l Label) MarshalJSON() ([]byte, error) {
	if l.isInt {
		return json.Marshal(fmt.Sprint(l.intValue))
	}
	return json.Marshal(l.strValue)
}
func (l *Label) UnmarshalJSON(data []byte) error {
	var strVal string
	if err := json.Unmarshal(data, &strVal); err != nil {
		return err
	}
	l.FromString(strVal)
	return nil
}
func (l Label) MarshalCBOR() ([]byte, error) {
	if l.isInt {
		return em.Marshal(l.intValue)
	}
	return em.Marshal(l.strValue)
}
func (l *Label) UnmarshalCBOR(data []byte) error {
	var intVal int
	err := dm.Unmarshal(data, &intVal)
	if err == nil {
		l.intValue = intVal
		l.isInt = true
		return nil
	}
	var strVal string
	err = dm.Unmarshal(data, &strVal)
	if err == nil {
		l.strValue = strVal
		l.isInt = false
	}
	return fmt.Errorf("could not extract Label from CBOR: %v", data)
}