Documentation ¶
Index ¶
- Constants
- Variables
- func AttributeSize(attr *Attribute) int64
- func AttributesSize(attrs map[string]*Attribute) int64
- func MakeAttributes(namedAttributes ...any) (map[string]*Attribute, error)
- func MakeUnion(attributesMaps ...map[string]*Attribute) map[string]*Attribute
- type Attribute
- func (*Attribute) Descriptor() ([]byte, []int)deprecated
- func (m *Attribute) GetDict() (map[string]string, bool)
- func (x *Attribute) GetDictVal() *DictAttr
- func (m *Attribute) GetList() ([]map[string]string, bool)
- func (x *Attribute) GetListVal() *ListAttr
- func (x *Attribute) GetStrVal() string
- func (m *Attribute) GetString() (string, bool)
- func (m *Attribute) GetValue() isAttribute_Value
- func (m *Attribute) IsEqual(other *Attribute) bool
- func (*Attribute) ProtoMessage()
- func (x *Attribute) ProtoReflect() protoreflect.Message
- func (x *Attribute) Reset()
- func (m *Attribute) SetString(value string) bool
- func (x *Attribute) String() string
- func (m *Attribute) Validate() error
- func (m *Attribute) ValidateAll() error
- type AttributeMultiError
- type AttributeValidationError
- type Attribute_DictVal
- type Attribute_ListVal
- type Attribute_StrVal
- type DictAttr
- func (*DictAttr) Descriptor() ([]byte, []int)deprecated
- func (x *DictAttr) GetValue() map[string]string
- func (*DictAttr) ProtoMessage()
- func (x *DictAttr) ProtoReflect() protoreflect.Message
- func (x *DictAttr) Reset()
- func (x *DictAttr) String() string
- func (m *DictAttr) Validate() error
- func (m *DictAttr) ValidateAll() error
- type DictAttrMultiError
- type DictAttrValidationError
- type ListAttr
- func (*ListAttr) Descriptor() ([]byte, []int)deprecated
- func (x *ListAttr) GetValue() []*DictAttr
- func (*ListAttr) ProtoMessage()
- func (x *ListAttr) ProtoReflect() protoreflect.Message
- func (x *ListAttr) Reset()
- func (x *ListAttr) String() string
- func (m *ListAttr) Validate() error
- func (m *ListAttr) ValidateAll() error
- type ListAttrMultiError
- type ListAttrValidationError
Constants ¶
const ( // MaxAttributesSize is the maximum total size in bytes, for the event+asset attributes. // // Currently the limiting factor is the eventsourcepoller topic with a max bytes of a message at // 262144 bytes. (256kb due to the pricing tier we have for azure service bus) // // The message being added to the topic is the evidence format for the entire event // (including asset creation events). So it is not the same size of the requested asset/event // via the api. // // We need some wiggle room for possible size increase due to conversion from api -> evidence format. // We need to take into account sizes principal_declared, principal_accepted, and timestamps as well. // // For now make the max 51,200 bytes. This allows for 10 attributes // with key size 1024 and value size 4096 to be created. // // Note. the input validation for attribute key/validation is measured in golang rune count, // not number of bytes. // // Note. it is easy to increase the limit, but harder to decrease. // Also Note. assets requests of size 100,000 bytes have been added successfully onto the block chain. MaxAttributesSize = 51200 )
Variables ¶
var File_attribute_v2_attribute_attribute_proto protoreflect.FileDescriptor
Functions ¶
func AttributeSize ¶
AttributeSize gets the size of the given attribute in bytes.
func AttributesSize ¶
AttributesSize gets the size of the given attributes in bytes.
including the key values in the map.
func MakeAttributes ¶
MakeAttributes accepts pairs of name, value and returns a map[string]*Attribute. value must be a string, a map[string]string or a []map[string]string
Types ¶
type Attribute ¶
type Attribute struct { // Types that are assignable to Value: // // *Attribute_StrVal // *Attribute_DictVal // *Attribute_ListVal Value isAttribute_Value `protobuf_oneof:"value"` // contains filtered or unexported fields }
func NewAttribute ¶
NewAttribute creates an attribute whose type is infered from a native go-lang type. string -> StrVal, map[string]string -> DictVal, []map[string]string -> ListVal
func NewDictAttribute ¶
func NewListAttribute ¶
func NewStringAttribute ¶
func (*Attribute) Descriptor
deprecated
func (*Attribute) GetDict ¶
GetDict returns the map if the value is the correct type. Otherwise the bool return value will be false.
func (*Attribute) GetDictVal ¶
func (*Attribute) GetList ¶
GetList returns the list of maps if the value is the correct type. Otherwise the bool return value will be false.
func (*Attribute) GetListVal ¶
func (*Attribute) GetString ¶
GetString returns the string if the value is the correct type. Otherwise the bool return value will be false.
func (*Attribute) IsEqual ¶
IsEqual returns true if both values are equal. For dicts and lists we do a deep compare. For lists, the the order of items in both list must be the same.
func (*Attribute) ProtoMessage ¶
func (*Attribute) ProtoMessage()
func (*Attribute) ProtoReflect ¶
func (x *Attribute) ProtoReflect() protoreflect.Message
func (*Attribute) SetString ¶
Sets an attribute to a string value and returns true IF its a string type Otherwise returns false
func (*Attribute) Validate ¶
Validate checks the field values on Attribute with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Attribute) ValidateAll ¶
ValidateAll checks the field values on Attribute with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in AttributeMultiError, or nil if none found.
type AttributeMultiError ¶
type AttributeMultiError []error
AttributeMultiError is an error wrapping multiple validation errors returned by Attribute.ValidateAll() if the designated constraints aren't met.
func (AttributeMultiError) AllErrors ¶
func (m AttributeMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (AttributeMultiError) Error ¶
func (m AttributeMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type AttributeValidationError ¶
type AttributeValidationError struct {
// contains filtered or unexported fields
}
AttributeValidationError is the validation error returned by Attribute.Validate if the designated constraints aren't met.
func (AttributeValidationError) Cause ¶
func (e AttributeValidationError) Cause() error
Cause function returns cause value.
func (AttributeValidationError) Error ¶
func (e AttributeValidationError) Error() string
Error satisfies the builtin error interface
func (AttributeValidationError) ErrorName ¶
func (e AttributeValidationError) ErrorName() string
ErrorName returns error name.
func (AttributeValidationError) Field ¶
func (e AttributeValidationError) Field() string
Field function returns field value.
func (AttributeValidationError) Key ¶
func (e AttributeValidationError) Key() bool
Key function returns key value.
func (AttributeValidationError) Reason ¶
func (e AttributeValidationError) Reason() string
Reason function returns reason value.
type Attribute_DictVal ¶
type Attribute_DictVal struct {
DictVal *DictAttr `protobuf:"bytes,2,opt,name=dict_val,json=dictVal,proto3,oneof"`
}
func (*Attribute_DictVal) Get ¶
func (dv *Attribute_DictVal) Get() map[string]string
GetDict returns the map if the value is the correct type. Otherwise the bool return value will be false.
type Attribute_ListVal ¶
type Attribute_ListVal struct {
ListVal *ListAttr `protobuf:"bytes,3,opt,name=list_val,json=listVal,proto3,oneof"`
}
func (*Attribute_ListVal) Get ¶
func (lv *Attribute_ListVal) Get() []map[string]string
GetList returns the list of maps if the value is the correct type. Otherwise the bool return value will be false.
type Attribute_StrVal ¶
type Attribute_StrVal struct {
StrVal string `protobuf:"bytes,1,opt,name=str_val,json=strVal,proto3,oneof"`
}
func (*Attribute_StrVal) Get ¶
func (sv *Attribute_StrVal) Get() string
type DictAttr ¶
type DictAttr struct { Value map[string]string `` /* 151-byte string literal not displayed */ // contains filtered or unexported fields }
func (*DictAttr) Descriptor
deprecated
func (*DictAttr) ProtoMessage ¶
func (*DictAttr) ProtoMessage()
func (*DictAttr) ProtoReflect ¶
func (x *DictAttr) ProtoReflect() protoreflect.Message
func (*DictAttr) Validate ¶
Validate checks the field values on DictAttr with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*DictAttr) ValidateAll ¶
ValidateAll checks the field values on DictAttr with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in DictAttrMultiError, or nil if none found.
type DictAttrMultiError ¶
type DictAttrMultiError []error
DictAttrMultiError is an error wrapping multiple validation errors returned by DictAttr.ValidateAll() if the designated constraints aren't met.
func (DictAttrMultiError) AllErrors ¶
func (m DictAttrMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (DictAttrMultiError) Error ¶
func (m DictAttrMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type DictAttrValidationError ¶
type DictAttrValidationError struct {
// contains filtered or unexported fields
}
DictAttrValidationError is the validation error returned by DictAttr.Validate if the designated constraints aren't met.
func (DictAttrValidationError) Cause ¶
func (e DictAttrValidationError) Cause() error
Cause function returns cause value.
func (DictAttrValidationError) Error ¶
func (e DictAttrValidationError) Error() string
Error satisfies the builtin error interface
func (DictAttrValidationError) ErrorName ¶
func (e DictAttrValidationError) ErrorName() string
ErrorName returns error name.
func (DictAttrValidationError) Field ¶
func (e DictAttrValidationError) Field() string
Field function returns field value.
func (DictAttrValidationError) Key ¶
func (e DictAttrValidationError) Key() bool
Key function returns key value.
func (DictAttrValidationError) Reason ¶
func (e DictAttrValidationError) Reason() string
Reason function returns reason value.
type ListAttr ¶
type ListAttr struct { Value []*DictAttr `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*ListAttr) Descriptor
deprecated
func (*ListAttr) ProtoMessage ¶
func (*ListAttr) ProtoMessage()
func (*ListAttr) ProtoReflect ¶
func (x *ListAttr) ProtoReflect() protoreflect.Message
func (*ListAttr) Validate ¶
Validate checks the field values on ListAttr with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*ListAttr) ValidateAll ¶
ValidateAll checks the field values on ListAttr with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ListAttrMultiError, or nil if none found.
type ListAttrMultiError ¶
type ListAttrMultiError []error
ListAttrMultiError is an error wrapping multiple validation errors returned by ListAttr.ValidateAll() if the designated constraints aren't met.
func (ListAttrMultiError) AllErrors ¶
func (m ListAttrMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ListAttrMultiError) Error ¶
func (m ListAttrMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ListAttrValidationError ¶
type ListAttrValidationError struct {
// contains filtered or unexported fields
}
ListAttrValidationError is the validation error returned by ListAttr.Validate if the designated constraints aren't met.
func (ListAttrValidationError) Cause ¶
func (e ListAttrValidationError) Cause() error
Cause function returns cause value.
func (ListAttrValidationError) Error ¶
func (e ListAttrValidationError) Error() string
Error satisfies the builtin error interface
func (ListAttrValidationError) ErrorName ¶
func (e ListAttrValidationError) ErrorName() string
ErrorName returns error name.
func (ListAttrValidationError) Field ¶
func (e ListAttrValidationError) Field() string
Field function returns field value.
func (ListAttrValidationError) Key ¶
func (e ListAttrValidationError) Key() bool
Key function returns key value.
func (ListAttrValidationError) Reason ¶
func (e ListAttrValidationError) Reason() string
Reason function returns reason value.