Publisher returns an event publisher if one is configured and the current context is not inside a transaction.
(ctx context.Context)
| 286 | // Publisher returns an event publisher if one is configured |
| 287 | // and the current context is not inside a transaction. |
| 288 | func (m *DB) Publisher(ctx context.Context) events.Publisher { |
| 289 | _, ok := boltutil.Transaction(ctx) |
| 290 | if ok { |
| 291 | // Do no publish events within a transaction |
| 292 | return nil |
| 293 | } |
| 294 | if m.dbopts.publisher != nil { |
| 295 | return m.dbopts.publisher |
| 296 | } |
| 297 | return nil |
| 298 | } |
| 299 | |
| 300 | // RegisterMutationCallback registers a function to be called after a metadata |
| 301 | // mutations has been performed. |