alarm

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alarm

type Alarm interface {
	Report(msg string)
}

Alarm 是警报器,用于记录那些需要被及时关注的错误情况

type AlarmFunc

type AlarmFunc func(msg string)

AlarmFunc 简化Alarm使用

func (AlarmFunc) Report

func (h AlarmFunc) Report(msg string)

Report 实现Alarm

type AlarmLog

type AlarmLog struct {
	ID        uint      `gorm:"primaryKey" json:"id"`
	Msg       string    `gorm:"type:varchar(255)" json:"msg"`
	Caller    string    `gorm:"type:varchar(255)" json:"caller"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

AlarmLog 记录系统中第一时间需要开发人员注意的信息

func (AlarmLog) TableName

func (AlarmLog) TableName() string

TableName 指定表名

type MysqlStoreAlarm

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

MysqlStoreAlarm 是使用mysql作为存储的Alarm

func NewMysqlStoreAlarm

func NewMysqlStoreAlarm(db *gorm.DB) *MysqlStoreAlarm

NewMysqlStoreAlarm 构造MysqlStoreAlarm

func (*MysqlStoreAlarm) Report

func (s *MysqlStoreAlarm) Report(msg string)

Report 实现Alarm

type RedisStoreAlarm

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

RedisStoreAlarm 是使用redis作为存储的Alarm

func NewRedisStoreAlarm

func NewRedisStoreAlarm(client *redis.Client) *RedisStoreAlarm

NewRedisStoreAlarm 构造RedisStoreAlarm

func (*RedisStoreAlarm) Report

func (s *RedisStoreAlarm) Report(msg string)

Report 实现Alarm

Jump to

Keyboard shortcuts

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