github.com/altipla-consulting/ravendb-go-client@v0.1.3/before_delete_event_args.go (about)

     1  package ravendb
     2  
     3  // BeforeDeleteEventArgs describes arguments for "before delete" listener
     4  type BeforeDeleteEventArgs struct {
     5  	documentMetadata *MetadataAsDictionary
     6  
     7  	Session    *InMemoryDocumentSessionOperations
     8  	DocumentID string
     9  	Entity     interface{}
    10  }
    11  
    12  func newBeforeDeleteEventArgs(session *InMemoryDocumentSessionOperations, documentID string, entity interface{}) *BeforeDeleteEventArgs {
    13  	return &BeforeDeleteEventArgs{
    14  		Session:    session,
    15  		DocumentID: documentID,
    16  		Entity:     entity,
    17  	}
    18  }
    19  
    20  // GetDocumentMetadata returns metadata for the entity being deleted
    21  func (a *BeforeDeleteEventArgs) GetDocumentMetadata() *MetadataAsDictionary {
    22  	if a.documentMetadata == nil {
    23  		a.documentMetadata, _ = a.Session.GetMetadataFor(a.Entity)
    24  	}
    25  
    26  	return a.documentMetadata
    27  }