Config

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: 4 Imported by: 0

Documentation

Overview

* @Author: NyanCatda * @Date: 2022-03-23 21:01:14 * @LastEditTime: 2022-03-23 21:41:50 * @LastEditors: NyanCatda * @Description: 读取配置项 * @FilePath: \Momizi\Internal\Plugin\JavaScript\Tools\Config\Config.go

Index

Constants

This section is empty.

Variables

View Source
var PluginPath = Controller.PluginPath + "/"

Functions

func RegistrationFunction

func RegistrationFunction(VM *goja.Runtime) error

*

  • @description: 注册配置文件函数
  • @param {*goja.Runtime} VM 实例
  • @return {error} 错误信息

Types

type Config

type Config struct {
	VM *goja.Runtime
}

func (Config) Delete

func (Config Config) Delete(Conf *JsonConfig.Config, Name string) bool

*

  • @description: 删除配置项
  • @param {string} Path 配置文件路径
  • @param {map[string]any} Default 默认配置
  • @param {string} Name 配置项名称
  • @return {bool} 是否删除成功

func (Config) Get

func (Config Config) Get(Conf *JsonConfig.Config, Name string) any

*

  • @description: 读取配置项
  • @param {string} Path 配置文件路径
  • @param {map[string]any} Default 默认配置
  • @param {string} Name 配置项名称
  • @return {*}

func (Config) Init

func (Config Config) Init(Path string, Default map[string]any) *JsonConfig.Config

*

  • @description: 初始化配置文件
  • @param {string} Path 配置文件路径
  • @param {map[string]any} Default 默认配置
  • @return {bool} 是否初始化成功

func (Config) Set

func (Config Config) Set(Conf *JsonConfig.Config, Name string, Value any) bool

*

  • @description: 设置配置项
  • @param {string} Path 配置文件路径
  • @param {map[string]any} Default 默认配置
  • @param {string} Name 配置项名称
  • @param {any} Value 配置项值
  • @return {bool} 是否设置成功

Jump to

Keyboard shortcuts

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