runtime

package
v0.0.0-...-727718e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyHandlerSideEffects

func ApplyHandlerSideEffects(ctx context.Context, exec *Executor, result map[string]interface{})

func ExecuteCrons

func ExecuteCrons(ctx context.Context, schema *ast.Schema, db *sql.DB) error

func ExecuteSeeds

func ExecuteSeeds(ctx context.Context, schema *ast.Schema, exec *Executor) error

func ExecuteSetups

func ExecuteSetups(ctx context.Context, schema *ast.Schema, exec *Executor) error

func FindCronEntry

func FindCronEntry(schema *ast.Schema, name string) *ast.CronEntry

func RootRequestIDFromCtx

func RootRequestIDFromCtx(ctx context.Context) string

func WithSystemBody

func WithSystemBody(body map[string]interface{}) map[string]interface{}

func WithSystemInput

func WithSystemInput(body map[string]interface{}) map[string]interface{}

Types

type CachedResult

type CachedResult struct {
	Result    map[string]interface{}
	Timestamp time.Time
	TTL       time.Duration
}

type ConnectionResult

type ConnectionResult struct {
	Edges      []EdgeResult
	PageInfo   PageInfoResult
	TotalCount int
}

type EdgeResult

type EdgeResult struct {
	Node   map[string]interface{}
	Cursor string // base64-encoded keyset cursor
}

type EventBus

type EventBus interface {
	PublishCRUD(op, model, id string, payload map[string]interface{})
}

type EventEmitter

type EventEmitter struct {
	// contains filtered or unexported fields
}

func (*EventEmitter) Emit

func (ee *EventEmitter) Emit(entityType string, entityID string, eventType string, payload map[string]interface{}) error

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(db *sql.DB, schema *ast.Schema, logger Logger) *Executor

func (*Executor) Avg

func (e *Executor) Avg(ctx context.Context, modelName, field string, req map[string]interface{}) (result float64, err error)

func (*Executor) Count

func (e *Executor) Count(ctx context.Context, modelName string, req map[string]interface{}) (result float64, err error)

func (*Executor) Create

func (e *Executor) Create(ctx context.Context, modelName string, req map[string]interface{}) (out map[string]interface{}, err error)

func (*Executor) DB

func (e *Executor) DB() *sql.DB

func (*Executor) Delete

func (e *Executor) Delete(ctx context.Context, modelName string, id string, req map[string]interface{}) (err error)

func (*Executor) DeleteMany

func (e *Executor) DeleteMany(ctx context.Context, modelName string, req map[string]interface{}) (n int64, err error)

func (*Executor) ExecuteCronBody

func (e *Executor) ExecuteCronBody(ctx context.Context, entry *ast.CronEntry) error

func (*Executor) ExecuteEffectActions

func (e *Executor) ExecuteEffectActions(ctx context.Context, stmts []ast.Statement, input map[string]interface{}, vars map[string]interface{}, entityID string) error

func (*Executor) ExternalManager

func (e *Executor) ExternalManager() *ExternalManager

func (*Executor) InputKeyForDBColumn

func (e *Executor) InputKeyForDBColumn(modelName, dbColumn string) (string, error)

func (*Executor) Max

func (e *Executor) Max(ctx context.Context, modelName, field string, req map[string]interface{}) (result float64, err error)

func (*Executor) Min

func (e *Executor) Min(ctx context.Context, modelName, field string, req map[string]interface{}) (result float64, err error)

func (*Executor) Read

func (e *Executor) Read(ctx context.Context, modelName string, req map[string]interface{}) (result []map[string]interface{}, err error)

func (*Executor) ReadConnection

func (e *Executor) ReadConnection(ctx context.Context, modelName string, req map[string]interface{}) (*ConnectionResult, error)

func (*Executor) RegisterRoomName

func (e *Executor) RegisterRoomName(name, id string)

func (*Executor) Restore

func (e *Executor) Restore(ctx context.Context, modelName string, id string, req map[string]interface{}) (err error)

func (*Executor) Schema

func (e *Executor) Schema() *ast.Schema

func (*Executor) SetEventBus

func (e *Executor) SetEventBus(bus EventBus)

func (*Executor) SetLogSink

func (e *Executor) SetLogSink(s LogSink)

func (*Executor) SetOutboxNotify

func (e *Executor) SetOutboxNotify(fn func(id string))

func (*Executor) SetRoomBus

func (e *Executor) SetRoomBus(b *events.RoomBus)

func (*Executor) Stddev

func (e *Executor) Stddev(ctx context.Context, modelName, field string, req map[string]interface{}) (result float64, err error)

func (*Executor) Sum

func (e *Executor) Sum(ctx context.Context, modelName, field string, req map[string]interface{}) (result float64, err error)

func (*Executor) Update

func (e *Executor) Update(ctx context.Context, modelName string, id string, req map[string]interface{}) (out map[string]interface{}, err error)

func (*Executor) UpdateMany

func (e *Executor) UpdateMany(ctx context.Context, modelName string, req map[string]interface{}) (n int64, err error)

func (*Executor) Variance

func (e *Executor) Variance(ctx context.Context, modelName, field string, req map[string]interface{}) (result float64, err error)

type ExternalHandler

type ExternalHandler func(ctx context.Context, input map[string]interface{}, store Store) (map[string]interface{}, error)

type ExternalManager

type ExternalManager struct {
	// contains filtered or unexported fields
}

func NewExternalManager

func NewExternalManager() *ExternalManager

func (*ExternalManager) Call

func (em *ExternalManager) Call(ctx context.Context, name string, input map[string]interface{}) (map[string]interface{}, error)

func (*ExternalManager) Register

func (em *ExternalManager) Register(name string, handler ExternalHandler)

func (*ExternalManager) RegisterURL

func (em *ExternalManager) RegisterURL(name, baseURL string)

func (*ExternalManager) SetRoomBus

func (em *ExternalManager) SetRoomBus(b *events.RoomBus)

type IdemResult

type IdemResult struct {
	Replayed bool
	Response []byte
}

type IdempotencyStore

type IdempotencyStore struct {
	// contains filtered or unexported fields
}

func NewIdempotencyStore

func NewIdempotencyStore(db *sql.DB) *IdempotencyStore

func (*IdempotencyStore) Begin

func (s *IdempotencyStore) Begin(ctx context.Context, key string) (*IdemResult, error)

func (*IdempotencyStore) Commit

func (s *IdempotencyStore) Commit(ctx context.Context, key string, result interface{}) error

func (*IdempotencyStore) CreateTable

func (s *IdempotencyStore) CreateTable(ctx context.Context) error

type JSONSink

type JSONSink struct {
	// contains filtered or unexported fields
}

func (*JSONSink) Emit

func (s *JSONSink) Emit(e LogEntry)

type LogEntry

type LogEntry struct {
	Timestamp     time.Time              `json:"ts"`
	Level         string                 `json:"level"`
	RootRequestID string                 `json:"root_request_id"`
	TraceID       string                 `json:"trace_id,omitempty"`
	SpanID        string                 `json:"span_id,omitempty"`
	Operation     string                 `json:"operation,omitempty"`
	Model         string                 `json:"model,omitempty"`
	Block         string                 `json:"block,omitempty"`
	Depth         int                    `json:"depth"`
	LineNo        int                    `json:"line_no,omitempty"`
	Message       string                 `json:"msg"`
	Fields        map[string]interface{} `json:"fields,omitempty"`
	Source        string                 `json:"source"`
}

type LogSink

type LogSink interface {
	Emit(LogEntry)
}

func NewSink

func NewSink() LogSink

type Logger

type Logger interface {
	Info(msg string, args ...interface{})
	Warn(msg string, args ...interface{})
	Error(msg string, args ...interface{})
}

func NewLoggerWrapper

func NewLoggerWrapper(logger *logrus.Logger) Logger

type LoggerWrapper

type LoggerWrapper struct {
	*logrus.Logger
}

func (*LoggerWrapper) Error

func (l *LoggerWrapper) Error(msg string, args ...interface{})

func (*LoggerWrapper) Info

func (l *LoggerWrapper) Info(msg string, args ...interface{})

Info logs a message with optional structured key-value pairs. Caller convention: Info("msg", "key1", val1, "key2", val2, ...) NOT printf-style — there are no format verbs in the message.

func (*LoggerWrapper) Warn

func (l *LoggerWrapper) Warn(msg string, args ...interface{})

type OutboxProcessor

type OutboxProcessor struct {
	// contains filtered or unexported fields
}

func NewOutboxProcessor

func NewOutboxProcessor(exec *Executor) *OutboxProcessor

func NewOutboxProcessorWithRedis

func NewOutboxProcessorWithRedis(exec *Executor, rdb *redis.Client) *OutboxProcessor

func (*OutboxProcessor) NotifyNewOutboxItem

func (op *OutboxProcessor) NotifyNewOutboxItem(id string)

func (*OutboxProcessor) PurgeFailedBefore

func (op *OutboxProcessor) PurgeFailedBefore(ctx context.Context, before time.Time) (int64, error)

func (*OutboxProcessor) RetryFailed

func (op *OutboxProcessor) RetryFailed(ctx context.Context, id string) error

func (*OutboxProcessor) Start

func (op *OutboxProcessor) Start(interval time.Duration)

func (*OutboxProcessor) Stop

func (op *OutboxProcessor) Stop()

type PageInfoResult

type PageInfoResult struct {
	HasNextPage bool
	HasPrevPage bool
	StartCursor string
	EndCursor   string
	TotalCount  int
}

type PrettySink

type PrettySink struct {
	// contains filtered or unexported fields
}

func (*PrettySink) Emit

func (s *PrettySink) Emit(e LogEntry)

type ReadStore

type ReadStore = Store

type Store

type Store interface {
	Read(ctx context.Context, model string, args map[string]interface{}) ([]map[string]interface{}, error)
	Create(ctx context.Context, model string, body map[string]interface{}) (map[string]interface{}, error)
	Update(ctx context.Context, model string, id string, patch map[string]interface{}) (map[string]interface{}, error)
	Delete(ctx context.Context, model string, id string) error
}

type StoreAdapter

type StoreAdapter struct {
	// contains filtered or unexported fields
}

func (*StoreAdapter) Create

func (s *StoreAdapter) Create(ctx context.Context, model string, body map[string]interface{}) (map[string]interface{}, error)

func (*StoreAdapter) Delete

func (s *StoreAdapter) Delete(ctx context.Context, model string, id string) error

func (*StoreAdapter) Read

func (s *StoreAdapter) Read(ctx context.Context, model string, args map[string]interface{}) ([]map[string]interface{}, error)

func (*StoreAdapter) Update

func (s *StoreAdapter) Update(ctx context.Context, model string, id string, patch map[string]interface{}) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL