mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
add placeholder functions for websocket state tracker
This commit is contained in:
@@ -11,14 +11,13 @@ import (
|
||||
|
||||
type Engine struct {
|
||||
db *gorm.DB
|
||||
channels map[string]*reactivity.Channel
|
||||
mutations map[string]func(ctx *MutationCtx) error
|
||||
queries map[string]func(ctx *QueryCtx) error
|
||||
}
|
||||
|
||||
func NewEngine(db *gorm.DB) *Engine {
|
||||
slog.SetLogLoggerLevel(slog.LevelDebug)
|
||||
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)}
|
||||
return &Engine{db: db, mutations: make(map[string]func(ctx *MutationCtx) error), queries: make(map[string]func(ctx *QueryCtx) error)}
|
||||
}
|
||||
|
||||
func (e *Engine) RegisterMutation(name string, mutation func(ctx *MutationCtx) error) {
|
||||
|
||||
+16
-6
@@ -2,12 +2,22 @@ package reactivity
|
||||
|
||||
import "github.com/gorilla/websocket"
|
||||
|
||||
type Subscription struct {
|
||||
ID string
|
||||
Conn *websocket.Conn
|
||||
// TODO: populate with needed structures for tracking state
|
||||
type Tracker struct {
|
||||
}
|
||||
|
||||
type Channel struct {
|
||||
ID string
|
||||
Subscriptions []*Subscription
|
||||
func NewTracker() *Tracker {
|
||||
return &Tracker{}
|
||||
}
|
||||
|
||||
func (t *Tracker) Track(conn *websocket.Conn) {}
|
||||
|
||||
func (t *Tracker) Untrack(conn *websocket.Conn) {}
|
||||
|
||||
func (t *Tracker) SubscribeToQuery(query string) {}
|
||||
|
||||
func (t *Tracker) UnsubscribeFromQuery(query string) {}
|
||||
|
||||
func (t *Tracker) GetQuerySubscriptions() []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user