JsonConfig

package
v0.0.0-...-3e87f45 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

* @Author: NyanCatda * @Date: 2022-03-23 20:18:31 * @LastEditTime: 2022-03-27 21:33:20 * @LastEditors: NyanCatda * @Description: 配置文件操作 * @FilePath: \Momizi\Internal\Plugin\Tools\JsonConfig\Config.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path    string
	Default map[string]any
}

func New

func New(Path string, Default map[string]any) *Config

*

  • @description: 创建配置文件类
  • @param {string} Path 配置文件路径
  • @param {string} Default 默认配置
  • @return {*}

func (Config) Delete

func (Config Config) Delete(Name string) error

*

  • @description: 删除配置项
  • @param {string} Name 配置项名称
  • @return {error} 错误信息

func (Config) Get

func (Config Config) Get(Name string) (any, error)

*

  • @description: 读取配置项
  • @param {string} Name 配置项名称
  • @return {any} 配置项值
  • @return {error} 错误信息

func (Config) Init

func (Config Config) Init() error

*

  • @description: 初始化配置文件
  • @param {*}
  • @return {error} 错误信息

func (Config) Set

func (Config Config) Set(Name string, Value any) error

*

  • @description: 写入配置项
  • @param {string} Name 配置项名称
  • @param {any} Value 配置项值
  • @return {error} 错误信息

Jump to

Keyboard shortcuts

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