utils

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DATA_PLACE_HOLE = "_DATA_PLACE_HOLE_"

Variables

This section is empty.

Functions

This section is empty.

Types

type RotateLog added in v1.0.7

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

func NewRotateLog added in v1.0.7

func NewRotateLog(logDir, fileTpl string) *RotateLog

*

  • 获取 RotateLog 新实例 *
  • @param logDir 日志存放目录, 带不带结尾的目录根号都行, 正反根号也都行
  • @param fileTpl 文件名模板, 字符串中常量 DATA_PLACE_HOLE 为日期的位置, 会被替换成当前日期, 例如 runtime-_DATA_PLACE_HOLE_.log * *

func (*RotateLog) SetBackupDir added in v1.0.7

func (_l *RotateLog) SetBackupDir(backupDir string) *RotateLog

func (*RotateLog) Write added in v1.0.7

func (_l *RotateLog) Write(p []byte) (int, error)

type Runner

type Runner struct {
	Runnable bool
}

func NewRunner

func NewRunner() *Runner

func (*Runner) Exec added in v1.0.5

func (_this *Runner) Exec(runnerFunc RunnerFunc) *Runner

func (*Runner) Failed added in v1.0.5

func (_this *Runner) Failed(runnerFunc RunnerFinishFunc) *Runner

func (*Runner) IsRunnable

func (_this *Runner) IsRunnable() bool

func (*Runner) Success added in v1.0.5

func (_this *Runner) Success(runnerFunc RunnerFinishFunc) *Runner

type RunnerFinishFunc

type RunnerFinishFunc func()

type RunnerFunc

type RunnerFunc func() bool

type SpinLock added in v1.0.4

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

SpinLock implements a simple atomic spin lock, the zero value for a SpinLock is an unlocked spinlock.

func (*SpinLock) Lock added in v1.0.4

func (sl *SpinLock) Lock()

Lock locks sl. If the lock is already in use, the caller blocks until Unlock is called

func (*SpinLock) String added in v1.0.4

func (sl *SpinLock) String() string

func (*SpinLock) TryLock added in v1.0.4

func (sl *SpinLock) TryLock() bool

TryLock will try to lock sl and return whether it succeed or not without blocking.

func (*SpinLock) Unlock added in v1.0.4

func (sl *SpinLock) Unlock()

Unlock unlocks sl, unlike [Mutex.Unlock](http://golang.org/pkg/sync/#Mutex.Unlock), there's no harm calling it on an unlocked SpinLock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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