conf

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigPath string = ""

app 的全局配置文件

Functions

func SetConfig

func SetConfig(ac AppConfig)

设置全局配置对象

Types

type AppConfig

type AppConfig struct {
	Title     string `yaml:"title" json:"Title"`         // 程序名称
	Debug     bool   `yaml:"debug" json:"Debug"`         // debug 模式
	Frameless bool   `yaml:"frameless" json:"Frameless"` // 无边框

	Pwdbox string `yaml:"pwdbox" json:"pwdbox"` // 保险箱路径
}

只能暴露给前端结构体的函数,成员变量不能访问,只能通过函数获取 推荐: 函数 和 数据使用不同的结构体

var Config AppConfig

app 的全局配置对象

func DefaultAppConfig

func DefaultAppConfig() AppConfig

type ConfigOps

type ConfigOps struct {
}

暴露给外部的操作对象

func NewConfigOps

func NewConfigOps() *ConfigOps

初始化空对象

func NewConfigOpsAndLoad

func NewConfigOpsAndLoad(path string) *ConfigOps

初始化并读取配置文件

func (*ConfigOps) Get

func (co *ConfigOps) Get() *AppConfig

func (*ConfigOps) LoadAppConfig

func (co *ConfigOps) LoadAppConfig(path string) AppConfig

加载

func (*ConfigOps) RefreshConfig

func (co *ConfigOps) RefreshConfig() AppConfig

刷新

func (*ConfigOps) Save

func (co *ConfigOps) Save() bool

不要在前端调用这个函数,前端的数据修改后并不会同步到后端

func (*ConfigOps) SaveAppConfig

func (co *ConfigOps) SaveAppConfig(newAc AppConfig) bool

这个是给前端调用的,修改全局配置并保存

Jump to

Keyboard shortcuts

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