app

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 37 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   = ""
)
View Source
var (
	ErrUserNotSupport = errors.Errorf("user setting not support")
)

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(bt BadgeType, name string, isCN bool, w http.ResponseWriter, r *http.Request)

func (*APP) Basic added in v0.3.6

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

Basic info

func (*APP) Card added in v0.6.0

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

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) ShowUserInfo added in v0.6.2

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

func (*APP) SubCal added in v0.4.0

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

SubCal SubmissionCalendar

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
	BadgeTypeFollowing
	BadgeTypeFollowers
	BadgeTypeChartRanking
	BadgeTypeChartSolved
	BadgeTypeChartSubmissionCalendar
	BadgeTypeQuestionProcessCard
	BadgeTypeContestRankingCard
)

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
	DebugAddress int
	SqlitePath   string
	EnableCron   bool
}

type MetricUserInfo added in v0.6.2

type MetricUserInfo struct {
	Name string `json:"name"`
	// IsCN string `json:"is_cn"`
	Time string `json:"last_time"`
}

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