coreruntime

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2025 License: BSD-3-Clause Imports: 20 Imported by: 0

README

coreruntime

Documentation

Overview

ctx.go
core_runtime

Created by Karim Hassan on 07/07/2025.

This file implements the context.Context interface for the core runtime. It allows the core runtime to be used as a context in Go's standard library and other libraries that require a context.Context implementation. It will most definitely change in the future

engine.go core_runtime

Created by Karim Hassan on 07/07/2025.

init.go core_runtime

Created by karim-w on 07/07/2025.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(deps Dependencies) error

Types

type Dependencies

type Dependencies struct {
	SQLDatabases map[string]*sql.DB
	RedisClients map[string]*redis.Client
	Tracer       runtimemodules.Tracer
	Logger       runtimemodules.Logger
	Redsync      *redsync.Redsync
}

type Engine

type Engine interface {
	context.Context

	// Lifecycle
	Start(
		opt StartOperationOptions,
	) (Engine, error)
	Stop() error
	Cleanup() error

	// LOGGER
	Logger() runtimemodules.Logger

	// STORE
	Get(key string) (any, bool)
	Set(key string, value any)

	// HTTP
	HTTP(url string) aych.Request

	// REDIS
	RDB(
		key string,
	) gopts.Option[*redis.Client]

	DLock(key string) (*redsync.Mutex, error)

	// SQL
	SQL(key string) gopts.Option[squeel.Pipeline]
	SQLBegin(key, id string) (squeel.Pipeline, bool, error)
	SQLCommit(key, id string) error
	SQLRollback(key, id string) error

	// TRACES
	TraceID() string
	SpanID() string
	ParentID() string
}

func New

func New() Engine

func NewWithOptions

func NewWithOptions(opt EngineOptions) Engine

type EngineOptions

type EngineOptions struct {
	Context  gopts.Option[context.Context]
	Timeout  gopts.Option[time.Duration]
	TraceID  gopts.Option[string]
	SpanID   gopts.Option[string]
	ParentID gopts.Option[string]
}

type StartOperationOptions

type StartOperationOptions struct {
	ModuleName    string
	OperationName string
	TransientArgs []runtimemodules.LoggerField
	ScopedArgs    []runtimemodules.LoggerField
}

Directories

Path Synopsis
tracer.go core_runtime
tracer.go core_runtime
traces.go core_runtime
traces.go core_runtime

Jump to

Keyboard shortcuts

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