Documentation ¶
Index ¶
- Constants
- type Bootstrapper
- type Data
- type EntityRelationship
- func (e *EntityRelationship) AddAttributes(ca documents.CollaboratorsAccess, prepareNewVersion bool, ...) error
- func (e *EntityRelationship) AddNFT(bool, common.Address, []byte, bool) error
- func (e *EntityRelationship) CalculateDocumentRoot() ([]byte, error)
- func (e *EntityRelationship) CalculateSigningRoot() ([]byte, error)
- func (e *EntityRelationship) CollaboratorCanUpdate(updated documents.Document, identity identity.DID) error
- func (e *EntityRelationship) CreateNFTProofs(identity.DID, common.Address, []byte, bool, bool) (prf *documents.DocumentProof, err error)
- func (e *EntityRelationship) CreateProofs(fields []string) (prf *documents.DocumentProof, err error)
- func (e *EntityRelationship) DeleteAttribute(key documents.AttrKey, prepareNewVersion bool) error
- func (e *EntityRelationship) DeriveFromClonePayload(_ context.Context, doc documents.Document) error
- func (e *EntityRelationship) DeriveFromCreatePayload(ctx context.Context, payload documents.CreatePayload) error
- func (e *EntityRelationship) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Document, error)
- func (*EntityRelationship) DocumentType() string
- func (e *EntityRelationship) FromJSON(jsonData []byte) error
- func (e *EntityRelationship) GetData() interface{}
- func (e *EntityRelationship) JSON() ([]byte, error)
- func (e *EntityRelationship) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
- func (e *EntityRelationship) Patch(payload documents.UpdatePayload) error
- func (e *EntityRelationship) Scheme() string
- func (e *EntityRelationship) Type() reflect.Type
- func (e *EntityRelationship) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
- type Service
Constants ¶
const ( // ErrERNotFound must be used to indicate that entity relationship for provided id is not found in the system ErrERNotFound = errors.Error("entity relationship not found in the system database.") // ErrERInvalidIdentifier must be used to indicate different identifier ErrERInvalidIdentifier = errors.Error("entity relationship contains different entity identifier") // ErrERNoToken must be used to indicate missing tokens ErrERNoToken = errors.Error("entity relationship contains no access token") // ErrNotEntityRelationship must be used if an expected entityRelationship model is not a entityRelationship ErrNotEntityRelationship = errors.Error("model not entity relationship") )
const ( // Scheme to identify entity relationship Scheme = prefix // ErrEntityRelationshipUpdate is a sentinel error for update failure. ErrEntityRelationshipUpdate = errors.Error("Entity relationship doesn't support updates.") )
const ( // BootstrappedEntityRelationshipService maps to the service for entity relationships BootstrappedEntityRelationshipService string = "BootstrappedEntityRelationshipService" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bootstrapper ¶
type Bootstrapper struct{}
Bootstrapper implements bootstrap.Bootstrapper.
func (Bootstrapper) Bootstrap ¶
func (Bootstrapper) Bootstrap(ctx map[string]interface{}) error
Bootstrap sets the required storage and registers
type Data ¶ added in v1.0.0
type Data struct { // Owner of the relationship OwnerIdentity *identity.DID `json:"owner_identity" swaggertype:"primitive,string"` // Entity identifier EntityIdentifier byteutils.HexBytes `json:"entity_identifier" swaggertype:"primitive,string"` // identity which will be granted access TargetIdentity *identity.DID `json:"target_identity" swaggertype:"primitive,string"` }
Data represents entity relationship data
type EntityRelationship ¶
type EntityRelationship struct { *documents.CoreDocument Data Data `json:"data"` }
EntityRelationship implements the documents.Document and keeps track of entity-relationship related fields and state.
func (*EntityRelationship) AddAttributes ¶ added in v1.0.0
func (e *EntityRelationship) AddAttributes(ca documents.CollaboratorsAccess, prepareNewVersion bool, attrs ...documents.Attribute) error
AddAttributes adds attributes to the EntityRelationship model.
func (*EntityRelationship) CalculateDocumentRoot ¶
func (e *EntityRelationship) CalculateDocumentRoot() ([]byte, error)
CalculateDocumentRoot calculates the document root.
func (*EntityRelationship) CalculateSigningRoot ¶
func (e *EntityRelationship) CalculateSigningRoot() ([]byte, error)
CalculateSigningRoot calculates the signing root of the document.
func (*EntityRelationship) CollaboratorCanUpdate ¶
func (e *EntityRelationship) CollaboratorCanUpdate(updated documents.Document, identity identity.DID) error
CollaboratorCanUpdate checks that the identity attempting to update the document is the identity which owns the document.
func (*EntityRelationship) CreateNFTProofs ¶
func (e *EntityRelationship) CreateNFTProofs(identity.DID, common.Address, []byte, bool, bool) (prf *documents.DocumentProof, err error)
CreateNFTProofs is not implemented for EntityRelationship.
func (*EntityRelationship) CreateProofs ¶
func (e *EntityRelationship) CreateProofs(fields []string) (prf *documents.DocumentProof, err error)
CreateProofs generates proofs for given fields.
func (*EntityRelationship) DeleteAttribute ¶ added in v1.0.0
func (e *EntityRelationship) DeleteAttribute(key documents.AttrKey, prepareNewVersion bool) error
DeleteAttribute deletes the attribute from the model.
func (*EntityRelationship) DeriveFromClonePayload ¶ added in v1.3.0
func (e *EntityRelationship) DeriveFromClonePayload(_ context.Context, doc documents.Document) error
DeriveFromClonePayload clones a new document.
func (*EntityRelationship) DeriveFromCreatePayload ¶ added in v1.0.0
func (e *EntityRelationship) DeriveFromCreatePayload(ctx context.Context, payload documents.CreatePayload) error
DeriveFromCreatePayload unpacks the entity relationship data from the Payload.
func (*EntityRelationship) DeriveFromUpdatePayload ¶ added in v1.0.0
func (e *EntityRelationship) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Document, error)
DeriveFromUpdatePayload removes any access tokens assigned to target did
func (*EntityRelationship) DocumentType ¶
func (*EntityRelationship) DocumentType() string
DocumentType returns the entity relationship document type.
func (*EntityRelationship) FromJSON ¶
func (e *EntityRelationship) FromJSON(jsonData []byte) error
FromJSON unmarshals the json bytes into EntityRelationship
func (*EntityRelationship) GetData ¶ added in v1.0.0
func (e *EntityRelationship) GetData() interface{}
GetData returns entity relationship data
func (*EntityRelationship) JSON ¶
func (e *EntityRelationship) JSON() ([]byte, error)
JSON marshals EntityRelationship into a json bytes
func (*EntityRelationship) PackCoreDocument ¶
func (e *EntityRelationship) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
PackCoreDocument packs the EntityRelationship into a CoreDocument.
func (*EntityRelationship) Patch ¶ added in v1.0.0
func (e *EntityRelationship) Patch(payload documents.UpdatePayload) error
Patch merges payload data into Document.
func (*EntityRelationship) Scheme ¶ added in v1.0.0
func (e *EntityRelationship) Scheme() string
Scheme returns the entity relationship scheme.
func (*EntityRelationship) Type ¶
func (e *EntityRelationship) Type() reflect.Type
Type gives the EntityRelationship type.
func (*EntityRelationship) UnpackCoreDocument ¶
func (e *EntityRelationship) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
UnpackCoreDocument unpacks the core document into an EntityRelationship.
type Service ¶
type Service interface { documents.Service // GetEntityRelationships returns a list of the latest versions of the relevant entity relationship based on an entity id GetEntityRelationships(ctx context.Context, entityID []byte) ([]documents.Document, error) }
Service defines specific functions for entity