cmd

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package cmd 初始化命令行环境

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(id, version string) error

Types

type Config

type Config struct {
	// Ratelimit API 限速的配置
	Ratelimit *Ratelimit `yaml:"ratelimit" xml:"ratelimit" json:"ratelimit"`

	// DB 数据库配置
	DB *DB `yaml:"db" xml:"db" json:"db"`

	// Admin 后台管理员用户的相关配置
	Admin *admin.Config `yaml:"admin" xml:"admin" json:"admin"`

	// System 系统模块的相关配置
	System *system.Config `yaml:"system" xml:"system" json:"system"`

	Member *member.Config `yaml:"member" xml:"member" json:"member"`
}

Config 配置文件的自定义部分内容

func (*Config) SanitizeConfig

func (c *Config) SanitizeConfig() *web.FieldError

type DB

type DB struct {
	// 表名前缀
	//
	// 可以为空。
	Prefix string `yaml:"prefix,omitempty" json:"prefix,omitempty" xml:"prefix,attr,omitempty"`

	// 表示数据库的类型
	//
	// 目前支持以下几种类型:
	//  - sqlite3
	//  - sqlite 纯 Go
	//  - mysql
	//  - mariadb
	//  - postgres
	Type string `yaml:"type" json:"type" xml:"type,attr"`

	// 连接数据库的参数
	DSN string `yaml:"dsn" json:"dsn" xml:"dsn"`
	// contains filtered or unexported fields
}

DB 数据库的配置项

func (*DB) DB

func (conf *DB) DB() *orm.DB

func (*DB) SanitizeConfig

func (conf *DB) SanitizeConfig() *web.FieldError

type Ratelimit

type Ratelimit struct {
	Prefix   string          `yaml:"prefix" json:"prefix" xml:"prefix"`            // 在缓存系统中前缀,保证数据的唯一性
	Rate     config.Duration `yaml:"rate" json:"rate" xml:"rate"`                  // 发放令牌的频率
	Capacity uint64          `yaml:"capacity" json:"capacity" xml:"capacity,attr"` // 令牌桶的最高容量
}

Ratelimit API 访问限制

func (*Ratelimit) SanitizeConfig

func (r *Ratelimit) SanitizeConfig() *web.FieldError

Jump to

Keyboard shortcuts

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