app

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default badgeType = iota + 1
	Ranking
	Solved
	SolvedRate
	Accepted
	AcceptedRate
	UserNotFound
)
View Source
const (
	// DefaultColor default color
	DefaultColor = "brightgreen"
)

Variables

View Source
var (
	BuildTime    = ""
	BuildVersion = ""
	BuildAppName = "lcbadge"
	CommitHash   = ""
)

Functions

func Monitor added in v0.1.2

func Monitor(h http.Handler) http.Handler

Monitor Monitor

Types

type APP

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

func New

func New(c Config) *APP

func (*APP) Badge

func (a *APP) Badge(w http.ResponseWriter, r *http.Request)

Badge badge

func (*APP) Cron added in v0.2.0

func (a *APP) Cron(spec string) error

Cron cron 30 8 * * * 每天凌晨 8 点 30 分 "@every 2s"

func (*APP) HistoryChart added in v0.2.0

func (a *APP) HistoryChart(w http.ResponseWriter, r *http.Request)

HistoryChart history chart

func (*APP) IndexPage added in v0.2.3

func (a *APP) IndexPage(w http.ResponseWriter, r *http.Request)

IndexPage index page

func (*APP) Profile

func (a *APP) Profile(w http.ResponseWriter, r *http.Request)

Profile user profile

func (*APP) Run

func (a *APP) Run() error

func (*APP) Version

func (a *APP) Version(w http.ResponseWriter, r *http.Request)

Version show version

type ChartShow added in v0.2.0

type ChartShow func(list []storage.HistoryRecord, name string) ([]byte, error)

ChartShow chart function

type Config

type Config struct {
	Debug bool

	Address     string
	CronSpec    string
	CacheType   string
	StorageType string

	RedisConfig RedisConfig
	MySQLConfig MySQLConfig
}

type MySQLConfig added in v0.2.0

type MySQLConfig struct {
	Host     string
	DBName   string
	User     string
	Password string
	Port     int
}

type RedisConfig added in v0.2.0

type RedisConfig struct {
	Address  string
	Password string
}

type WaitGroupWrapper added in v0.1.2

type WaitGroupWrapper struct {
	sync.WaitGroup
}

WaitGroupWrapper wrap sync.WaitGroup

func (*WaitGroupWrapper) Wrap added in v0.1.2

func (w *WaitGroupWrapper) Wrap(cb func())

Wrap wrap

Jump to

Keyboard shortcuts

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