mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
added some stuff
This commit is contained in:
+18
@@ -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,8 +8,14 @@ import (
|
||||
type Engine struct {
|
||||
db *gorm.DB
|
||||
channels map[string]*reactivity.Channel
|
||||
mutations []func(ctx *MutationCtx) error
|
||||
queries []func(ctx *QueryCtx) error
|
||||
}
|
||||
|
||||
func NewEngine(db *gorm.DB) *Engine {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user