starter

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupWithTimeout

func CleanupWithTimeout(fn func() error, timeout time.Duration) error

func LoadConfig

func LoadConfig(paths []string) (*config.Config, error)

Types

type CleanupStack

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

func (*CleanupStack) Add

func (s *CleanupStack) Add(fn func() error)

func (*CleanupStack) Close

func (s *CleanupStack) Close() error

type Runtime

type Runtime struct {
	Config   *config.Config
	Logger   *slog.Logger
	DB       *gorm.DB
	Database db.Database
	// Deprecated: use Database. Kept for compatibility with older services.
	SQL          db.Database
	Redis        redis.UniversalClient
	RedisRuntime *cache.Redis
	S3           objectstore.Client
	Casdoor      *casdoor.Adapter
	Authn        authn.Authenticator
	Authz        authz.Authorizer
	Audit        audit.Recorder
	Access       *access.Guard
	Session      *session.Manager
	Tx           *db.TxManager
	Permission   permission.Manager
	Metrics      *metrics.Metrics
}

func NewRuntime

func NewRuntime(ctx context.Context, cfg *config.Config, opts ...RuntimeOption) (*Runtime, func() error, error)

func NewRuntimeFromConfig

func NewRuntimeFromConfig(ctx context.Context, paths []string, opts ...RuntimeOption) (*config.Config, *Runtime, func() error, error)

func (*Runtime) DBFromContext

func (rt *Runtime) DBFromContext(ctx context.Context) *gorm.DB

func (*Runtime) WithTx

func (rt *Runtime) WithTx(ctx context.Context, fn func(ctx context.Context, tx *gorm.DB) error) error

type RuntimeFactoryOptions

type RuntimeFactoryOptions struct {
	ConfigPaths    []string
	RuntimeOptions []RuntimeOption
}

type RuntimeOption

type RuntimeOption func(*Runtime)

Jump to

Keyboard shortcuts

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