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 {
|
type Engine struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
channels map[string]*reactivity.Channel
|
|
||||||
mutations map[string]func(ctx *MutationCtx) error
|
mutations map[string]func(ctx *MutationCtx) error
|
||||||
queries map[string]func(ctx *QueryCtx) error
|
queries map[string]func(ctx *QueryCtx) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEngine(db *gorm.DB) *Engine {
|
func NewEngine(db *gorm.DB) *Engine {
|
||||||
slog.SetLogLoggerLevel(slog.LevelDebug)
|
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) {
|
func (e *Engine) RegisterMutation(name string, mutation func(ctx *MutationCtx) error) {
|
||||||
|
|||||||
+16
-6
@@ -2,12 +2,22 @@ package reactivity
|
|||||||
|
|
||||||
import "github.com/gorilla/websocket"
|
import "github.com/gorilla/websocket"
|
||||||
|
|
||||||
type Subscription struct {
|
// TODO: populate with needed structures for tracking state
|
||||||
ID string
|
type Tracker struct {
|
||||||
Conn *websocket.Conn
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Channel struct {
|
func NewTracker() *Tracker {
|
||||||
ID string
|
return &Tracker{}
|
||||||
Subscriptions []*Subscription
|
}
|
||||||
|
|
||||||
|
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