cosgo

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 20 Imported by: 16

README

cosgo

go game 开发中

Documentation

Index

Constants

View Source
const (
	AppConfigDebug              string = "debug"
	AppConfigNamePidFile        string = "pid"           //pid file dir
	AppConfigNameLogsDir        string = "logs"          //logs dir
	AppConfigNameDaemonize      string = "daemonize"     //后台运行
	AppConfigNameConfigFileExt  string = "ConfigFileExt" //config file default ext name,只能在程序中设置
	AppConfigNameConfigFileName string = "config"        //config file

)

Variables

View Source
var Config = &config{Viper: viper.New()}
View Source
var GCSummaryTime time.Duration = time.Second * 300

GCSummaryTime 报告性能摘要时间间隔

View Source
var Options = &struct {
	Banner  func()
	Process func() bool //设置启动进程,返回false时不会继续向下执行

}{
	Banner: defaultBanner,
}
View Source
var SignalReload syscall.Signal = 10

SignalReload 重新加载系统信号 kill -10 pid

View Source
var Version string = "unknown"

Functions

func Abs

func Abs(dir ...string) string

Abs 获取以工作路径为起点的绝对路径

func Close

func Close(force bool)

Close 外部关闭程序

func Console added in v0.0.3

func Console(format any, args ...any)

Console 控制台输出

func Debug

func Debug() bool

func Dir

func Dir() string

Dir APP主程序所在目录

func Modules

func Modules() (r []string)

func Name

func Name() string

Name 项目内部获取appName

func On

func On(e EventType, f EventFunc)

func Reload added in v0.0.2

func Reload()

func SIGHUP added in v0.0.2

func SIGHUP()

SIGHUP 关闭控制台

func SetBanner

func SetBanner(f func())

SetBanner 设置默认启动界面,启动完所有MOD后执行

func SetProcess

func SetProcess(f func() bool)

func Start

func Start(waitForSystemExit bool, mods ...IModule)

*

  • 应用程序启动
  • @param mods 需注册的模块

func Use

func Use(mods ...IModule)

func WaitForSystemExit

func WaitForSystemExit()

func WorkDir

func WorkDir() string

WorkDir 程序工作目录

Types

type EventFunc

type EventFunc func() error

type EventType

type EventType int32
const (
	EventTypStarting EventType = iota
	EventTypStarted
	EventTypStopping
	EventTypStopped
)

type IModule added in v0.0.2

type IModule interface {
	ID() string
	Init() error
	Start() error
	Close() error
	Reload() error
}

type Module

type Module struct {
	Id string
}

func NewModule

func NewModule(id string) *Module

func (*Module) Close

func (m *Module) Close() error

func (*Module) ID

func (m *Module) ID() string

func (*Module) Init

func (m *Module) Init() error

func (*Module) Reload added in v0.0.2

func (m *Module) Reload() error

func (*Module) Start

func (m *Module) Start() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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