Call oncreate callback if new elem created while loading

This commit is contained in:
2020-12-06 00:56:37 +01:00
parent 0bc4e62d80
commit 18d9f9bed3
4 changed files with 32 additions and 3 deletions
+6
View File
@@ -17,6 +17,7 @@ type Query struct {
updater Updater
ondecode Callbacks
onclose Callbacks
oncreate Callbacks
}
// And function pushes the elem query to the $and array of the query
@@ -122,6 +123,11 @@ func (q *Query) OnClose() (callbacks Callbacks) {
return q.onclose
}
// OnCreate callback is called if the mongox creates a new document instance during loading
func (q *Query) OnCreate() (callbacks Callbacks) {
return q.onclose
}
// Empty checks the query for any content
func (q *Query) Empty() (isEmpty bool) {
return len(q.m) == 0