mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-05-22 15:53:36 +00:00
Call oncreate callback if new elem created while loading
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user