fixed realtime delete event to be called after the record was deleted from the db

This commit is contained in:
Gani Georgiev
2023-05-29 22:28:07 +03:00
parent 729f9f142e
commit 7de346b532
3 changed files with 62 additions and 12 deletions
+11
View File
@@ -35,6 +35,9 @@ type Client interface {
// Set stores any value to the client's context.
Set(key string, value any)
// Unset removes a single value from the client's context.
Unset(key string)
// Get retrieves the key value from the client's context.
Get(key string) any
@@ -157,6 +160,14 @@ func (c *DefaultClient) Set(key string, value any) {
c.store[key] = value
}
// Unset implements the [Client.Unset] interface method.
func (c *DefaultClient) Unset(key string) {
c.mux.Lock()
defer c.mux.Unlock()
delete(c.store, key)
}
// Discard implements the [Client.Discard] interface method.
func (c *DefaultClient) Discard() {
c.mux.Lock()