Documentation ¶
Index ¶
- Constants
- func CreateAttributesList(current documents.Model, data interface{}, fieldKey, typeLabel string) ([]documents.Attribute, error)
- func DeleteAttributesSet(model documents.Model, data interface{}, idx, fieldKey string) (documents.Model, error)
- func FillAttributeList(data interface{}, idx, fieldKey string) ([]documents.Attribute, error)
- func FindAttributeSetIDX(model documents.Model, attributeSetID, typeLabel, idLabel, fieldKey string) (idx string, err error)
- func GenerateLabel(field, idx, fieldName string) string
- func GetArrayLatestIDX(model documents.Model, typeLabel string) (idx *documents.Int256, err error)
- func IncrementArrayAttrIDX(model documents.Model, typeLabel string) (attr documents.Attribute, err error)
- func LabelFromJSONTag(idx, jsonTag string, fieldKey string) string
- func NewAttributeSetID() string
- func ToMapAttributes(attrs []documents.Attribute) map[documents.AttrKey]documents.Attribute
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 ¶
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 ¶
GenerateLabel generates a field label
func GetArrayLatestIDX ¶
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 ¶
LabelFromJSONTag converts a JSON tag to a label
func NewAttributeSetID ¶
func NewAttributeSetID() string
NewAttributeSetID generates an identifier for a new attribute set
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.