beego: Index | Files

package toolbox

import ""

Package toolbox healthcheck

type DatabaseCheck struct { }

func (dc *DatabaseCheck) Check() error {

if dc.isConnected() {
	return nil
} else {
	return errors.New("can't connect database")



more docs:


Package Files

healthcheck.go profile.go statistics.go task.go


var AdminCheckList map[string]HealthChecker

AdminCheckList holds health checker map Deprecated using governor.AdminCheckList

var (
    AdminTaskList map[string]Tasker

The bounds for each field.

func AddHealthCheck Uses

func AddHealthCheck(name string, hc HealthChecker)

AddHealthCheck add health checker with name string

func AddTask Uses

func AddTask(taskname string, t Tasker)

AddTask add task with name

func ClearTask Uses

func ClearTask()

ClearTask clear all tasks

func DeleteTask Uses

func DeleteTask(taskname string)

DeleteTask delete task with name

func GetCPUProfile Uses

func GetCPUProfile(w io.Writer)

GetCPUProfile start cpu profile monitor

func MemProf Uses

func MemProf(w io.Writer)

MemProf record memory profile in pprof

func PrintGCSummary Uses

func PrintGCSummary(w io.Writer)

PrintGCSummary print gc information to io.Writer

func ProcessInput Uses

func ProcessInput(input string, w io.Writer)

ProcessInput parse input command string

func StartTask Uses

func StartTask()

StartTask start all tasks

func StopTask Uses

func StopTask()

StopTask stop all tasks

type HealthChecker Uses

type HealthChecker governor.HealthChecker

HealthChecker health checker interface

type MapSorter Uses

type MapSorter task.MapSorter

MapSorter sort map for tasker

func NewMapSorter Uses

func NewMapSorter(m map[string]Tasker) *MapSorter

NewMapSorter create new tasker map

func (*MapSorter) Len Uses

func (ms *MapSorter) Len() int

func (*MapSorter) Less Uses

func (ms *MapSorter) Less(i, j int) bool

func (*MapSorter) Sort Uses

func (ms *MapSorter) Sort()

Sort sort tasker map

func (*MapSorter) Swap Uses

func (ms *MapSorter) Swap(i, j int)

type Schedule Uses

type Schedule task.Schedule

Schedule time taks schedule

func (*Schedule) Next Uses

func (s *Schedule) Next(t time.Time) time.Time

Next set schedule to next time

type Statistics Uses

type Statistics web.Statistics

Statistics struct

type Task Uses

type Task struct {
    // Deprecated
    Taskname string
    // Deprecated
    Spec *Schedule
    // Deprecated
    SpecStr string
    // Deprecated
    DoFunc TaskFunc
    // Deprecated
    Prev time.Time
    // Deprecated
    Next time.Time
    // Deprecated
    Errlist []*taskerr // like errtime:errinfo
    // Deprecated
    ErrLimit int // max length for the errlist, 0 stand for no limit
    // contains filtered or unexported fields

Task task struct Deprecated

func NewTask Uses

func NewTask(tname string, spec string, f TaskFunc) *Task

NewTask add new task with name, time and func

func (*Task) GetNext Uses

func (t *Task) GetNext() time.Time

GetNext get the next call time of this task

func (*Task) GetPrev Uses

func (t *Task) GetPrev() time.Time

GetPrev get prev time of this task

func (*Task) GetSpec Uses

func (t *Task) GetSpec() string

GetSpec get spec string

func (*Task) GetStatus Uses

func (t *Task) GetStatus() string

GetStatus get current task status

func (*Task) Run Uses

func (t *Task) Run() error

Run run all tasks

func (*Task) SetCron Uses

func (t *Task) SetCron(spec string)

SetCron some signals:

*: any time
,:  separate signal


/n : do as n times of time duration


0/30 * * * * *                        every 30s
0 43 21 * * *                         21:43
0 15 05 * * *                        05:15
0 0 17 * * *                          17:00
0 0 17 * * 1                           17:00 in every Monday
0 0,10 17 * * 0,2,3                   17:00 and 17:10 in every Sunday, Tuesday and Wednesday
0 0-10 17 1 * *                       17:00 to 17:10 in 1 min duration each time on the first day of month
0 0 0 1,15 * 1                        0:00 on the 1st day and 15th day of month
0 42 4 1 * *                         4:42 on the 1st day of month
0 0 21 * * 1-6                       21:00 from Monday to Saturday
0 0,10,20,30,40,50 * * * *            every 10 min duration
0 */10 * * * *                     every 10 min duration
0 * 1 * * *                       1:00 to 1:59 in 1 min duration each time
0 0 1 * * *                       1:00
0 0 */1 * * *                      0 min of hour in 1 hour duration
0 0 * * * *                       0 min of hour in 1 hour duration
0 2 8-20/3 * * *                   8:02, 11:02, 14:02, 17:02, 20:02
0 30 5 1,15 * *                    5:30 on the 1st day and 15th day of month

func (*Task) SetNext Uses

func (t *Task) SetNext(now time.Time)

SetNext set next time for this task

func (*Task) SetPrev Uses

func (t *Task) SetPrev(now time.Time)

SetPrev set prev time of this task

type TaskFunc Uses

type TaskFunc func() error

TaskFunc task func type

type Tasker Uses

type Tasker interface {
    GetSpec() string
    GetStatus() string
    Run() error
    GetNext() time.Time
    GetPrev() time.Time

Tasker task interface

type URLMap Uses

type URLMap web.URLMap

URLMap contains several statistics struct to log different data

var StatisticsMap *URLMap

StatisticsMap hosld global statistics data map

func (*URLMap) AddStatistics Uses

func (m *URLMap) AddStatistics(requestMethod, requestURL, requestController string, requesttime time.Duration)

AddStatistics add statistics task. it needs request method, request url, request controller and statistics time duration

func (*URLMap) GetMap Uses

func (m *URLMap) GetMap() map[string]interface{}

GetMap put url statistics result in io.Writer

func (*URLMap) GetMapData Uses

func (m *URLMap) GetMapData() []map[string]interface{}

GetMapData return all mapdata

Package toolbox imports 8 packages (graph). Updated 2020-11-07. Refresh now. Tools for package owners.