core

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 22 Imported by: 7

Documentation

Index

Constants

View Source
const (
	EventError    = "event.error"
	EventTracing  = "event.tracing"
	EventInit     = "event.gin.inited" //trigger when gin ready to service.
	EventStopping = "event.gin.stopping"
	EventStarted  = "sys.started" //trigger when all inited done.
)
View Source
const (
	EncryptedFile = "config/app.cfg"
)

Variables

View Source
var AppName = "RFID App"
View Source
var Bus = EventBus.New()
View Source
var ConfigFolder = "config"
View Source
var Container = dig.New()
View Source
var EmbedConfigFile = "embed" // for init function can't guarantee embed config be load before startup, so write all content to file.
View Source
var StartupOptions = dig.Group("startups")
View Source
var Version = "latest"

Functions

func CloseOnlyNotified added in v0.8.15

func CloseOnlyNotified()

func Decrypt added in v0.8.14

func Decrypt(key, src []byte) ([]byte, error)

func Encrypt added in v0.8.14

func Encrypt(key, raw []byte) ([]byte, error)

func EncryptConfig added in v0.8.14

func EncryptConfig() error

func GenerateEmbedConfigfile added in v0.7.4

func GenerateEmbedConfigfile() error

func GetContainer

func GetContainer() *dig.Container

func InitConfig

func InitConfig(p Bootup) error

func InitEmbedConfig added in v0.8.17

func InitEmbedConfig()

make sure run it in main before init anything, just make sure, all embed config inited.

func InitLogger

func InitLogger(p Bootup) (*zap.Logger, error)

func InvokeAsyncOnServiceStarted added in v0.8.15

func InvokeAsyncOnServiceStarted(fn any)

func InvokeOnServiceStarted added in v0.8.15

func InvokeOnServiceStarted(fn any)

func NotifyStarted added in v0.7.8

func NotifyStarted()

func NotifyStopping added in v0.8.11

func NotifyStopping()

func OnEvent added in v0.8.14

func OnEvent(topic string, fn SystenEvent)

func OnServiceStarted added in v0.8.11

func OnServiceStarted(fn SystenEvent)

OnServiceStarted make sure call this func after

func OnServiceStopping added in v0.8.11

func OnServiceStopping(fn SystenEvent)

func PrintVersion added in v0.8.15

func PrintVersion()

func Provide added in v0.5.0

func Provide(constructor ...interface{})

func ProvideStartup added in v0.5.1

func ProvideStartup(constructor ...any)

func ReadEncryptConfig added in v0.8.14

func ReadEncryptConfig(secret []byte, toFile string) error

func ToEmbedConfig added in v0.5.4

func ToEmbedConfig(content []byte, keys ...string)

Types

type Bootup added in v0.5.4

type Bootup struct {
	dig.In
	Secret           ConfigSecret
	EmbedConfigReady EmbedConfigReady
}

type ConfigSecret added in v0.8.14

type ConfigSecret []byte

type EmbedConfigReady added in v0.8.17

type EmbedConfigReady interface{}

type OptionalParam added in v0.5.7

type OptionalParam[T any] struct {
	dig.In
	P T `optional:"true"`
}

type ServiceParam added in v0.8.3

type ServiceParam struct {
	dig.In
	DB     *gorm.DB
	Logger *zap.Logger
	Bus    EventBus.Bus
}

type Startup added in v0.5.1

type Startup interface{}

type SystenEvent added in v0.8.11

type SystenEvent func()

Jump to

Keyboard shortcuts

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