tool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Overview

* @Author: howie * @Date: 2019-07-02 11:38:19 * @Last Modified by: holiday * @Last Modified time: 2019-07-02 13:19:17

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTime

func GetTime() int64

func Init

func Init()

func NewWorker

func NewWorker(workerId int64) error

func QuitSignal

func QuitSignal(quitFunc func())

Types

type Logger

type Logger struct {
	*zap.Logger
	sync.RWMutex
	Opts *Options `json:"opts"`
	// contains filtered or unexported fields
}

func GetLogger

func GetLogger() (ret *Logger)

GetLogger returns logger

type Options

type Options struct {
	LogFileDir    string
	AppName       string
	ErrorFileName string
	WarnFileName  string
	InfoFileName  string
	DebugFileName string
	MaxSize       int
	MaxBackups    int
	MaxAge        int
	zap.Config
}

type RedisLock

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

func NewRedisLock

func NewRedisLock(conn *redis.Client, key, val string, timeout time.Duration) *RedisLock

func (*RedisLock) GetLockKey

func (lock *RedisLock) GetLockKey() string

func (*RedisLock) GetLockVal

func (lock *RedisLock) GetLockVal() string

func (*RedisLock) TryLock

func (lock *RedisLock) TryLock() (bool, error)

return true ===> Get the lock successfully

func (*RedisLock) UnLock

func (lock *RedisLock) UnLock() error

type Worker

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

func GetWorker

func GetWorker() *Worker

func (*Worker) GetId

func (w *Worker) GetId() int64

Jump to

Keyboard shortcuts

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