Documentation
¶
Index ¶
- Variables
- func AuthAdmin(r *ghttp.Request)
- func AuthBase(r *ghttp.Request, name string)
- func AuthIndex(r *ghttp.Request)
- func AuthLoginSession(ctx context.Context, sessionKey string)
- func CORSMiddleware(r *ghttp.Request)
- func CreateFileDir() error
- func DefaultConfigInit()
- func DefaultSqliteConfigInit(path string, autoTime []string, debug bool, prefix ...string)
- func LoginCountSession(ctx context.Context, sessionKey string)
- func LoginJson(r *ghttp.Request, msg string, data ...interface{})
- func MiddlewareError(r *ghttp.Request)
- func NoLogin(r *ghttp.Request)
- func ResponseJson(ctx context.Context, data interface{})
- func SetConfigAndRun(s *ghttp.Server, address string)
- func Start(agent string, maxSessionTime time.Duration, isApi bool, maxBody ...int64) *ghttp.Server
- type ApiRes
- type Config
- type DatabaseConfig
- type DatabaseDefault
- type Json
- type LoggerConfig
- type PageSize
- type ServiceConfig
- type ServiceDefault
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigPath = filepath.Join(gfile.Pwd(), "manifest", "config", "config.yaml")
View Source
var DefaultConfig = Config{ Server: ServiceConfig{ Default: ServiceDefault{ Address: ":8080", LogPath: "./log/", LogStdout: true, ErrorStack: true, ErrorLogEnabled: true, ErrorLogPattern: "error-{Ymd}.log", AccessLogEnable: false, FileServerEnabled: true, }, }, OpenAPITitle: "", OpenAPIDescription: "Api列表 包含各端接口信息 字段注释 枚举说明", OpenAPIUrl: "https://panel.magicany.cc:8888/btpanel", OpenAPIName: "", DoMain: []string{"localhost", "127.0.0.1"}, OpenAPIVersion: "v1.0", Dns: "root:123456@tcp(127.0.0.1:3306)/test", Logger: LoggerConfig{ Path: "./log/", File: "access-{Ymd}.log", Level: "all", TimeFormat: "2006-01-02 15:04:05", CtxKeys: []string{}, Header: true, Stdout: true, RotateSize: "1M", RotateBackupLimit: 10, }, }
Functions ¶
func AuthLoginSession ¶
func CORSMiddleware ¶
func DefaultConfigInit ¶
func DefaultConfigInit()
func DefaultSqliteConfigInit ¶
DefaultSqliteConfigInit 创建默认的sqlite数据库配置 不会再生成配置文件 @param path sqlite数据库路径 @param autoTime 自动时间字段[]string{"create_time","update_time"} @param debug 数据库调试模式 @param prefix 表前缀可空
func LoginCountSession ¶
func SetConfigAndRun ¶
SetConfigAndRun 设置配置并运行服务 @param s *ghttp.Server 服务实例 @param address string 监听地址
Types ¶
type ApiRes ¶
type ApiRes struct {
// contains filtered or unexported fields
}
func (*ApiRes) FileDownload ¶
func (*ApiRes) FileSelect ¶
type Config ¶
type Config struct {
Server ServiceConfig `yaml:"server"`
Database *DatabaseConfig `yaml:"database"`
SkipUrl string `yaml:"skipUrl"`
OpenAPITitle string `yaml:"openAPITitle"`
OpenAPIDescription string `yaml:"openAPIDescription"`
OpenAPIUrl string `yaml:"openAPIUrl"`
OpenAPIName string `yaml:"openAPIName"`
DoMain []string `yaml:"doMain"`
OpenAPIVersion string `yaml:"openAPIVersion"`
Logger LoggerConfig `yaml:"logger"`
Dns string `yaml:"dns"`
}
type DatabaseConfig ¶
type DatabaseConfig struct {
Default DatabaseDefault `yaml:"default"`
}
type DatabaseDefault ¶
type DatabaseDefault struct {
Host string `yaml:"host" json:"host"`
Link string `yaml:"link" dc:"数据库连接字符串" json:"link"`
Port string `yaml:"port" json:"port"`
User string `yaml:"user" json:"user"`
Pass string `yaml:"pass" json:"pass"`
Name string `yaml:"name" json:"name"`
Type string `yaml:"type" json:"type"`
Timezone string `yaml:"timezone" json:"timezone"`
Debug bool `yaml:"debug" json:"debug"`
Charset string `yaml:"charset" json:"charset"`
CreatedAt string `yaml:"createdAt" json:"createdAt"`
UpdatedAt string `yaml:"updatedAt" json:"updatedAt"`
}
type LoggerConfig ¶
type LoggerConfig struct {
Path string `yaml:"path" json:"path"`
File string `yaml:"file" json:"file"`
Level string `yaml:"level" json:"level"`
TimeFormat string `yaml:"timeFormat" json:"timeFormat"`
CtxKeys []string `yaml:"ctxKeys" json:"ctxKeys"`
Header bool `yaml:"header" json:"header"`
Stdout bool `yaml:"stdout" json:"stdout"`
RotateSize string `yaml:"rotateSize" json:"rotateSize"`
RotateBackupLimit int `yaml:"rotateBackupLimit" json:"rotateBackupLimit"`
StdoutColorDisabled bool `yaml:"stdoutColorDisabled" json:"stdoutColorDisabled"`
WriterColorEnable bool `yaml:"writerColorEnable" json:"writerColorEnable"`
}
type PageSize ¶
type ServiceConfig ¶
type ServiceConfig struct {
Default ServiceDefault `yaml:"default"`
}
type ServiceDefault ¶
type ServiceDefault struct {
Address string `yaml:"address"`
LogPath string `yaml:"logPath"`
LogStdout bool `yaml:"logStdout"`
ErrorStack bool `yaml:"errorStack"`
ErrorLogEnabled bool `yaml:"errorLogEnabled"`
ErrorLogPattern string `yaml:"errorLogPattern"`
AccessLogEnable bool `yaml:"accessLogEnable"`
AccessLogPattern string `yaml:"accessLogPattern"`
FileServerEnabled bool `yaml:"fileServerEnabled"`
}
Click to show internal directories.
Click to hide internal directories.