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

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