core

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 6 Imported by: 0

README

Core

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

func CreateApp

func CreateApp(opts ...Option) *App

Function to get the app instance (similar to app() in Laravel)

func (*App) Config

func (a *App) Config() interface{}

func (*App) Exists

func (a *App) Exists(key Keywords) bool

func (*App) Get

func (a *App) Get(key Keywords) (interface{}, error)

func (*App) GetContext

func (a *App) GetContext() *context.Context

func (*App) RegisterPlugin

func (a *App) RegisterPlugin(path string, config interface{}) error

func (*App) RootPath

func (a *App) RootPath() string

func (*App) SetConfig

func (a *App) SetConfig(config interface{}) *App

func (*App) SetRootPath

func (a *App) SetRootPath(path string) *App

func (*App) Use

func (a *App) Use(key Keywords, createFunc func() (interface{}, error)) error

type Keywords

type Keywords string
const (
	CacheKeyword         Keywords = "cache"
	LoggerKeyword        Keywords = "logger"
	CLIKeyword           Keywords = "cli"
	DatabaseKeyword      Keywords = "database"
	WorkerKeyword        Keywords = "worker"
	SMSKeyword           Keywords = "sms"
	PluginManagerKeyword Keywords = "pluginManager"
)

func (Keywords) IsValid

func (k Keywords) IsValid() bool

type Option

type Option interface {
}

func Config

func Config(config interface{}) Option

func RootPath

func RootPath(name string) Option

Queue returns an option to specify the queue to enqueue the task into.

type Singleton

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

Singleton struct for managing Singletons

func NewSingleton

func NewSingleton() *Singleton

NewSingleton creates a new Singleton factory

func (*Singleton) Exists

func (s *Singleton) Exists(key string) bool

Exists checks if an instance exists for the given key

func (*Singleton) Get

func (s *Singleton) Get(key string) (interface{}, error)

Get returns an instance for the given key, creating it if it does not exist

func (*Singleton) Register

func (s *Singleton) Register(key string, createFunc func() (interface{}, error)) error

Register a creator function for a given key

Jump to

Keyboard shortcuts

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