app

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CronSpec = "30 8 * * *"
)
View Source
const (
	// DefaultColor default color
	DefaultColor = "brightgreen"
)

Variables

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

Functions

func IndexPage added in v0.3.0

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

IndexPage index page

func Router added in v0.3.0

func Router(r *mux.Router, a *APP, w io.Writer)

func Version added in v0.3.0

func Version() string

Types

type APP

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

func New

func New(cfg Config) *APP

func (*APP) Badge

func (a *APP) Badge(badgeType BadgeType, name string, isCN bool, w http.ResponseWriter, r *http.Request)

Badge badge

func (*APP) Chart added in v0.3.0

func (a *APP) Chart(badgeType BadgeType, name string, isCN bool, w http.ResponseWriter, r *http.Request)

func (*APP) Cron added in v0.2.0

func (a *APP) Cron(spec string)

Cron cron 30 8 * * * 每天凌晨 8 点 30 分

func (*APP) HandlerFunc added in v0.3.0

func (a *APP) HandlerFunc(badgeType BadgeType, isCN bool) http.Handler

func (*APP) Run

func (a *APP) Run() error

func (*APP) Setup added in v0.3.0

func (a *APP) Setup() (err error)

func (*APP) Version

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

Version Show version

type BadgeType added in v0.3.0

type BadgeType int
const (
	BadgeTypeProfile BadgeType = iota + 1
	BadgeTypeUserNotFound
	BadgeTypeRanking
	BadgeTypeSolved
	BadgeTypeSolvedRate
	BadgeTypeAccepted
	BadgeTypeAcceptedRate
	BadgeTypeChartRanking
	BadgeTypeChartSolved
)

func (BadgeType) String added in v0.3.0

func (b BadgeType) String() string

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 {
	Address    string
	SqlitePath string
	EnableCron bool
}

type Config2 added in v0.3.0

type Config2 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
}

Jump to

Keyboard shortcuts

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