extensions

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ErrArrayIndex must be used for invalid funding array indexes
	ErrArrayIndex = errors.Error("invalid array index")

	// ErrAttributeSetNotFound must be used if the id of a custom attribute set is not found in a model
	ErrAttributeSetNotFound = errors.Error("id of custom attribute set not found in model")

	// ErrDeriveAttr must be used if it is not possible to derive an attribute set from a document
	ErrDeriveAttr = errors.Error("stored attribute set in document has an error")

	// ErrPayload must be used if it is not possible to derive an attribute set from a payload
	ErrPayload = errors.Error("could not derive attribute set from payload")

	// ErrJSON must be used if it is not possible to derive a json
	ErrJSON = errors.Error("could not derive JSON from the attributes")

	// ErrAttributeSetID must be used if the provided attribute set id has an error
	ErrAttributeSetID = errors.Error("attribute set ID needs to be hex or empty")

	// ErrAttrSetSignature must be used if a signature on an attribute set is invalid
	ErrAttrSetSignature = errors.Error("stored signature on attribute set in document has an error")
)

Variables

This section is empty.

Functions

func CreateAttributesList

func CreateAttributesList(current documents.Model, data interface{}, fieldKey, typeLabel string) ([]documents.Attribute, error)

CreateAttributesList creates an attributes list on a passed in document

func DeleteAttributesSet

func DeleteAttributesSet(model documents.Model, data interface{}, idx, fieldKey string) (documents.Model, error)

DeleteAttributesSet deletes attributes that already exist on a given model for the addition of new attributes to the set

func FillAttributeList

func FillAttributeList(data interface{}, idx, fieldKey string) ([]documents.Attribute, error)

FillAttributeList fills an attributes list from the JSON object

func FindAttributeSetIDX

func FindAttributeSetIDX(model documents.Model, attributeSetID, typeLabel, idLabel, fieldKey string) (idx string, err error)

FindAttributeSetIDX returns the index of an attribute set given given its descriptive label

func GenerateLabel

func GenerateLabel(field, idx, fieldName string) string

GenerateLabel generates a field label

func GetArrayLatestIDX

func GetArrayLatestIDX(model documents.Model, typeLabel string) (idx *documents.Int256, err error)

GetArrayLatestIDX gets the last index from an array of attributes

func IncrementArrayAttrIDX

func IncrementArrayAttrIDX(model documents.Model, typeLabel string) (attr documents.Attribute, err error)

IncrementArrayAttrIDX increments the index of an array for a new attribute

func LabelFromJSONTag

func LabelFromJSONTag(idx, jsonTag string, fieldKey string) string

LabelFromJSONTag converts a JSON tag to a label

func NewAttributeSetID

func NewAttributeSetID() string

NewAttributeSetID generates an identifier for a new attribute set

func ToMapAttributes

func ToMapAttributes(attrs []documents.Attribute) map[documents.AttrKey]documents.Attribute

ToMapAttributes converts an array of documents.Attributes to a map

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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