configs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GIT = "https://github.com/"
	API = "https://api.github.com/repos/"
)

Functions

func SetNil

func SetNil[C any, T utils.CanNil[C]](a *T, b T)

设置引用类型对象默认值

func SetZero

func SetZero[T comparable](a *T, b T)

设置值类型对象默认值

Types

type Config

type Config struct {
	// 引擎
	*gin.Engine
	// 端口 0~65535
	Port uint16 `yaml:"port"`
	// 资源文件管理器
	Resource resource.Explorer
	// 资源文件夹路径
	Path Path `yaml:"path"`
	// Github 主页
	Github Github `yaml:"github"`
	// 管理员
	Administrators []string `yaml:"administrators"`
}

webhook 配置

func (*Config) Init

func (r *Config) Init() *Config

自动填充

func (*Config) UpdateIndex

func (r *Config) UpdateIndex() (err error)

更新主页

type Github

type Github struct {
	Username   string `yaml:"username"`
	Repository string `yaml:"repository"`
	Branche    string `yaml:"branche"`
	Commit     struct {
		Sha string `json:"sha"`
	} `json:"commit"`
	// contains filtered or unexported fields
}

func (*Github) Clone

func (g *Github) Clone(folder string) error

克隆到文件夹

func (*Github) GetLatestCommit

func (g *Github) GetLatestCommit() error

获取最新提交

func (*Github) Init

func (g *Github) Init()

type LifeCycle

type LifeCycle interface {
	// 初始化
	OnCreate(*Config)
	// 跨域设置
	OnCors(*Config)
	// 静态资源绑定
	OnStatic(*Config)
	// 访客接口
	Visitor(*Config)
	// 鉴定提交者权限
	OnAuthorize(*Config)
	// 提交者接口
	Submitter(*Config)
	// 鉴定管理员权限
	OnAdmin(*Config)
	// 管理员接口
	Administrator(*Config)
	// 绑定所有接口
	Bind(*Config)
}

type Path

type Path struct {
	Root   string `yaml:"root"`
	Views  string `yaml:"views"`
	Public string `yaml:"public"`
	Posts  string `yaml:"posts"`
	Users  string `yaml:"users"`
}

资源文件夹路径

func (*Path) Init

func (p *Path) Init()

Jump to

Keyboard shortcuts

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