From cb921f2c5e7fad1fabc4deaa2d7c76854137f227 Mon Sep 17 00:00:00 2001 From: Hein Date: Fri, 15 May 2026 14:59:34 +0200 Subject: [PATCH] fix(websocketspec): add transaction access to HookContext --- pkg/websocketspec/handler.go | 1 + pkg/websocketspec/hooks.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/pkg/websocketspec/handler.go b/pkg/websocketspec/handler.go index 0c978c4..e6c12e0 100644 --- a/pkg/websocketspec/handler.go +++ b/pkg/websocketspec/handler.go @@ -174,6 +174,7 @@ func (h *Handler) handleRequest(conn *Connection, msg *Message) { Options: msg.Options, ID: recordID, Data: msg.Data, + Tx: h.db, Metadata: make(map[string]interface{}), } diff --git a/pkg/websocketspec/hooks.go b/pkg/websocketspec/hooks.go index cc2dbe7..25012a8 100644 --- a/pkg/websocketspec/hooks.go +++ b/pkg/websocketspec/hooks.go @@ -111,6 +111,9 @@ type HookContext struct { AbortMessage string // Message to return if aborted AbortCode int // HTTP status code if aborted + // Tx provides access to the database/transaction for executing additional SQL + Tx common.Database + // Metadata is additional context data Metadata map[string]interface{} }