Documentation ¶
Index ¶
- Constants
- func CreateValidator(factory identity.Factory) documents.ValidatorGroup
- func UpdateValidator(factory identity.Factory, repo anchors.AnchorRepository) documents.ValidatorGroup
- type Bootstrapper
- type Data
- type EntityRelationship
- func (e *EntityRelationship) AddAttributes(ca documents.CollaboratorsAccess, prepareNewVersion bool, ...) error
- func (e *EntityRelationship) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error
- func (e *EntityRelationship) CalculateDataRoot() ([]byte, error)
- func (e *EntityRelationship) CalculateDocumentRoot() ([]byte, error)
- func (e *EntityRelationship) CalculateSigningRoot() ([]byte, error)
- func (e *EntityRelationship) CollaboratorCanUpdate(updated documents.Model, identity identity.DID) error
- func (e *EntityRelationship) CreateNFTProofs(account identity.DID, registry common.Address, tokenID []byte, ...) (proofs []*proofspb.Proof, err error)
- func (e *EntityRelationship) CreateProofs(fields []string) (proofs []*proofspb.Proof, err error)
- func (e *EntityRelationship) DeleteAttribute(key documents.AttrKey, prepareNewVersion bool) error
- func (e *EntityRelationship) DeriveFromCreatePayload(ctx context.Context, payload documents.CreatePayload) error
- func (e *EntityRelationship) DeriveFromUpdatePayload(context.Context, documents.UpdatePayload) (documents.Model, error)
- func (e *EntityRelationship) DocumentRootTree() (tree *proofs.DocumentTree, err 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 ¶
func CreateValidator ¶
func CreateValidator(factory identity.Factory) documents.ValidatorGroup
CreateValidator returns a validator group that should be run before creating the entity and persisting it to DB
func UpdateValidator ¶
func UpdateValidator(factory identity.Factory, repo anchors.AnchorRepository) documents.ValidatorGroup
UpdateValidator returns a validator group that should be run before updating the entity
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.Model 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) AddNFT ¶
func (e *EntityRelationship) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error
AddNFT is not implemented for EntityRelationship
func (*EntityRelationship) CalculateDataRoot ¶
func (e *EntityRelationship) CalculateDataRoot() ([]byte, error)
CalculateDataRoot calculates the data root.
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.Model, 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( account identity.DID, registry common.Address, tokenID []byte, nftUniqueProof, readAccessProof bool) (proofs []*proofspb.Proof, err error)
CreateNFTProofs is not implemented for EntityRelationship.
func (*EntityRelationship) CreateProofs ¶
func (e *EntityRelationship) CreateProofs(fields []string) (proofs []*proofspb.Proof, 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) 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, documents.UpdatePayload) (documents.Model, error)
DeriveFromUpdatePayload is not implemented for entity relationship.
func (*EntityRelationship) DocumentRootTree ¶
func (e *EntityRelationship) DocumentRootTree() (tree *proofs.DocumentTree, err error)
DocumentRootTree creates and returns the document root tree.
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.Model, error) }
Service defines specific functions for entity
func DefaultService ¶
func DefaultService( srv documents.Service, repo repository, queueSrv queue.TaskQueuer, jobManager jobs.Manager, factory identity.Factory, anchorRepo anchors.AnchorRepository, ) Service
DefaultService returns the default implementation of the service.