added some stuff

This commit is contained in:
2026-02-26 15:11:47 -06:00
parent bdad774b16
commit 1d3e911515
2 changed files with 26 additions and 2 deletions
+18
View File
@@ -0,0 +1,18 @@
package tether
import "gorm.io/gorm"
type AuthCtx struct {
UserID string
IsLoggedIn bool
}
type QueryCtx struct {
DB *gorm.DB
AuthCtx *AuthCtx
}
type MutationCtx struct {
DB *gorm.DB
AuthCtx *AuthCtx
}
+8 -2
View File
@@ -6,10 +6,16 @@ import (
) )
type Engine struct { type Engine struct {
db *gorm.DB db *gorm.DB
channels map[string]*reactivity.Channel channels map[string]*reactivity.Channel
mutations []func(ctx *MutationCtx) error
queries []func(ctx *QueryCtx) error
} }
func NewEngine(db *gorm.DB) *Engine { func NewEngine(db *gorm.DB) *Engine {
return &Engine{db: db, channels: make(map[string]*reactivity.Channel)} return &Engine{db: db, channels: make(map[string]*reactivity.Channel)}
} }
func (e *Engine) RegisterMutation(mutation func(ctx *MutationCtx) error) {
e.mutations = append(e.mutations, mutation)
}