helper

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateShortLayout  = "2006-01-02"
	DateFullLayout   = "2006-01-02 15:04:05"
	TimeLocationName = "Asia/Shanghai"
)

Variables

This section is empty.

Functions

func CurrentMethodName

func CurrentMethodName() string

func GetTypeName

func GetTypeName(typ reflect.Type) string

GetTypeName returns a string representing the name of the object typ. if the name is defined then it is used, otherwise, the name is derived from the Stringer interface.

the stringer returns something like *somepkg.MyStruct, so skip the *somepkg and return MyStruct

func IsEmpty

func IsEmpty(i interface{}) bool

func IsNotEmpty

func IsNotEmpty(i interface{}) bool

func OnStop added in v0.7.0

func OnStop(clean func())

OnStop 退出信号拦截 在POSIX.1-1990标准中定义的信号列表

信号 值 动作 说明 SIGHUP 1 Term 终端控制进程结束(终端连接断开) SIGINT 2 Term 用户发送INTR字符(Ctrl+C)触发 SIGQUIT 3 Core 用户发送QUIT字符(Ctrl+/)触发 SIGILL 4 Core 非法指令(程序错误、试图执行数据段、栈溢出等) SIGABRT 6 Core 调用abort函数触发 SIGFPE 8 Core 算术运行错误(浮点运算错误、除数为零等) SIGKILL 9 Term 无条件结束程序(不能被捕获、阻塞或忽略) SIGSEGV 11 Core 无效内存引用(试图访问不属于自己的内存空间、对只读内存空间进行写操作) SIGPIPE 13 Term 消息管道损坏(FIFO/Socket通信时,管道未打开而进行写操作) SIGALRM 14 Term 时钟定时信号 SIGTERM 15 Term 结束程序(可以被捕获、阻塞或忽略) SIGUSR1 30,10,16 Term 用户保留 SIGUSR2 31,12,17 Term 用户保留 SIGCHLD 20,17,18 Ign 子进程结束(由父进程接收) SIGCONT 19,18,25 Cont 继续执行已经停止的进程(不能被阻塞) SIGSTOP 17,19,23 Stop 停止进程(不能被捕获、阻塞或忽略) SIGTSTP 18,20,24 Stop 停止进程(可以被捕获、阻塞或忽略) SIGTTIN 21,21,26 Stop 后台程序从终端中读取数据时触发 SIGTTOU 22,22,27 Stop 后台程序向终端中写数据时触发

func Substring

func Substring(str string, start, length int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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