mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
fixed a dumb error
This commit is contained in:
@@ -82,7 +82,7 @@ func (e *Engine) InvalidateTable(tableName string) {
|
|||||||
slog.Debug("Invalidating subscription", "subscription", subscription["clientID"])
|
slog.Debug("Invalidating subscription", "subscription", subscription["clientID"])
|
||||||
params := map[string]interface{}{}
|
params := map[string]interface{}{}
|
||||||
json.Unmarshal([]byte(subscription["params"]), ¶ms)
|
json.Unmarshal([]byte(subscription["params"]), ¶ms)
|
||||||
_, err := e.ExecuteQuery(query, params)
|
_, err := e.ExecuteQuery(query, params, subscription["clientID"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("Failed to execute query", "error", err)
|
slog.Error("Failed to execute query", "error", err)
|
||||||
continue
|
continue
|
||||||
@@ -91,7 +91,7 @@ func (e *Engine) InvalidateTable(tableName string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Engine) ExecuteQuery(query string, params map[string]interface{}) (interface{}, error) {
|
func (e *Engine) ExecuteQuery(query string, params map[string]interface{}, clientID string) (interface{}, error) {
|
||||||
/*
|
/*
|
||||||
TODO: implement the logic to execute the query
|
TODO: implement the logic to execute the query
|
||||||
Steps needed:
|
Steps needed:
|
||||||
@@ -101,10 +101,12 @@ func (e *Engine) ExecuteQuery(query string, params map[string]interface{}) (inte
|
|||||||
4. Calculate hash for every query
|
4. Calculate hash for every query
|
||||||
5. Send the updated queries if hash changed
|
5. Send the updated queries if hash changed
|
||||||
*/
|
*/
|
||||||
|
slog.Debug("Executing query", "query", query, "params", params)
|
||||||
|
e.queries[query](&QueryCtx{DB: e.db, AuthCtx: &AuthCtx{UserID: "", IsLoggedIn: true}, Params: params})
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Engine) ExecuteMutation(mutation string, params map[string]interface{}) (interface{}, error) {
|
func (e *Engine) ExecuteMutation(mutation string, params map[string]interface{}, clientID string) (interface{}, error) {
|
||||||
result := e.mutations[mutation](&MutationCtx{DB: e.db, AuthCtx: &AuthCtx{UserID: "", IsLoggedIn: true}, Params: params})
|
result := e.mutations[mutation](&MutationCtx{DB: e.db, AuthCtx: &AuthCtx{UserID: "", IsLoggedIn: true}, Params: params})
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
@@ -115,7 +117,7 @@ func (e *Engine) OnReceiveMessage(clientID string, msg map[string]interface{}) e
|
|||||||
case "query":
|
case "query":
|
||||||
e.tracker.SubscribeToQuery(clientID, msg["location"].(string), msg["params"].(map[string]string))
|
e.tracker.SubscribeToQuery(clientID, msg["location"].(string), msg["params"].(map[string]string))
|
||||||
case "mutation":
|
case "mutation":
|
||||||
e.ExecuteMutation(msg["location"].(string), msg["params"].(map[string]interface{}))
|
e.ExecuteMutation(msg["location"].(string), msg["params"].(map[string]interface{}), clientID)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user