Documentation
¶
Index ¶
- Constants
- type Auth
- type AuthCtx
- type Engine
- func (e *Engine) CreateTable(name string, schema interface{})
- func (e *Engine) ExecuteMutation(mutation string, params map[string]interface{}, clientID string, ...) (interface{}, error)
- func (e *Engine) ExecuteMutationInternal(mutation string, params map[string]interface{}) (interface{}, error)
- func (e *Engine) ExecuteQuery(query string, params map[string]interface{}, ...) ([]byte, error)
- func (e *Engine) GetDependentQueries(tableName string) []string
- func (e *Engine) Handle(w http.ResponseWriter, r *http.Request)
- func (e *Engine) InvalidateTag(tag string)
- func (e *Engine) InvalidateTags(tags []string, execID string, actionName string)
- func (e *Engine) OnConnect(clientID string) error
- func (e *Engine) OnDisconnect(clientID string) error
- func (e *Engine) OnReceiveMessage(clientID string, msg map[string]interface{}) error
- func (e *Engine) RegisterCron(cronName string, cronString string, functionName string, ...) (string, error)
- func (e *Engine) RegisterGuard(name string, guard func(ctx *GuardCtx) interface{})
- func (e *Engine) RegisterMutation(name string, mutation func(ctx *MutationCtx) interface{}, ...)
- func (e *Engine) RegisterQuery(name string, query func(ctx *QueryCtx) interface{}, dependencies []string, ...)
- func (e *Engine) SetAllowedOrigins(allowedOrigins []string)
- func (e *Engine) SetAuth(auth Auth)
- func (e *Engine) SetCheckOrigin(checkOrigin func(r *http.Request) bool)
- type Guard
- type GuardCtx
- type Mutation
- type MutationCtx
- type MutationOptions
- type Query
- type QueryCtx
- type QueryOptions
- type SchedulerCtx
- type TetherTask
Constants ¶
View Source
const ( ContextKeyExecutionID traceContextKey = "exec_id" ContextKeyActionName traceContextKey = "action_name" )
View Source
const SCHEDULE_LOOKAHEAD = 15 * time.Second
View Source
const SCHEDULE_LOOP_INTERVAL = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
Profiler *utilities.Profiler
EphemeralID string
// contains filtered or unexported fields
}
func (*Engine) CreateTable ¶
func (*Engine) ExecuteMutation ¶
func (*Engine) ExecuteMutationInternal ¶ added in v0.3.0
func (*Engine) ExecuteQuery ¶
func (e *Engine) ExecuteQuery(query string, params map[string]interface{}, subscription *reactivity.Subscription, forceSend bool) ([]byte, error)
func (*Engine) GetDependentQueries ¶
func (*Engine) InvalidateTag ¶
func (*Engine) InvalidateTags ¶ added in v0.2.0
InvalidateTags re-runs each distinct subscription that listens to any of the given tags. Subscriptions are snapshotted before any query executes so a re-run that picks up additional tags (e.g. auto-tracked primary keys) cannot cause the same mutation to fire the query a second time. Matching subscriptions (same query, params, and auth fingerprint) share one execution and are fanned out with each client's own query_key.
func (*Engine) OnDisconnect ¶
func (*Engine) OnReceiveMessage ¶
func (*Engine) RegisterCron ¶ added in v0.5.0
func (*Engine) RegisterGuard ¶ added in v0.4.0
func (*Engine) RegisterMutation ¶
func (e *Engine) RegisterMutation(name string, mutation func(ctx *MutationCtx) interface{}, opts ...MutationOptions)
func (*Engine) RegisterQuery ¶
func (e *Engine) RegisterQuery(name string, query func(ctx *QueryCtx) interface{}, dependencies []string, opts ...QueryOptions)
func (*Engine) SetAllowedOrigins ¶
Simple helper to set the allowed origins for the websocket connection
type GuardCtx ¶ added in v0.4.0
type GuardCtx struct {
DB *gorm.DB
Auth *AuthCtx
Params map[string]interface{}
Profiler *utilities.Profiler
Dependencies []string
}
func (*GuardCtx) TrackCollection ¶ added in v0.4.0
func (*GuardCtx) TrackTable ¶ added in v0.4.0
type Mutation ¶ added in v0.3.0
type Mutation struct {
Func func(ctx *MutationCtx) interface{}
Internal bool
}
type MutationCtx ¶
type MutationOptions ¶ added in v0.3.0
type MutationOptions struct {
Internal bool
}
type QueryCtx ¶
type QueryCtx struct {
DB *gorm.DB
Auth *AuthCtx
Scheduler *SchedulerCtx
Params map[string]interface{}
Dependencies []string
}
func (*QueryCtx) TrackCollection ¶
func (*QueryCtx) TrackTable ¶
type QueryOptions ¶ added in v0.3.0
type QueryOptions struct {
Internal bool
}
type SchedulerCtx ¶ added in v0.5.0
type TetherTask ¶ added in v0.5.0
type TetherTask struct {
ID string `gorm:"primaryKey"`
Name string `gorm:"uniqueIndex:idx_tether_cron_name,where:is_cron = true"` // unique among crons; one-shot tasks leave this empty
FunctionName string `gorm:"not null"`
ParamsJSON string
ExecuteAt time.Time `gorm:"index"`
ClaimedBy *string `gorm:"index"`
LockedUntil *time.Time
// Cron specific (Can be empty for runAfter tasks)
CronString *string // e.g., "0 16 1 * *"
LastExecuted *time.Time
IsCron bool
}
Click to show internal directories.
Click to hide internal directories.