time to start working on this again

This commit is contained in:
2026-04-07 10:37:55 -05:00
parent 1d3e911515
commit aface85b80
+11 -5
View File
@@ -8,14 +8,20 @@ import (
type Engine struct {
db *gorm.DB
channels map[string]*reactivity.Channel
mutations []func(ctx *MutationCtx) error
queries []func(ctx *QueryCtx) error
mutations map[string]func(ctx *MutationCtx) error
queries map[string]func(ctx *QueryCtx) error
}
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), mutations: make(map[string]func(ctx *MutationCtx) error), queries: make(map[string]func(ctx *QueryCtx) error)}
}
func (e *Engine) RegisterMutation(mutation func(ctx *MutationCtx) error) {
e.mutations = append(e.mutations, mutation)
func (e *Engine) RegisterMutation(name string, mutation func(ctx *MutationCtx) error) {
e.mutations[name] = mutation
}
func (e *Engine) RegisterQuery(name string, query func(ctx *QueryCtx) error) {
e.queries[name] = query
}