Documentation ¶
Index ¶
- Constants
- Variables
- func FileGetContent(file string) (content string, err error)
- func FilePutContent(file string, data string) int
- func GetType(value interface{}) string
- func IsType(value interface{}, ty string) bool
- func ParseKeyValueByExpressStr(data string, assignOpt string) (map[string]string, bool)
- func ParseStrLine(data string, assignOpt string) (map[string]string, error)
- func Read(file string, buf interface{}) (data []byte, err error)
- func StrToAny(value string) interface{}
- func ToString(value interface{}) string
- func Write(file string, data string) int
- type DefaultParser
- type File
- type FileSchema
- type IEnvironment
- type ObjectEnv
- func (app *ObjectEnv) Get(key string, def interface{}) interface{}
- func (app *ObjectEnv) GetAll() map[string]string
- func (app *ObjectEnv) IsSet(key string) bool
- func (app *ObjectEnv) IsSupport(path string) bool
- func (app ObjectEnv) Load(path string) *ObjectEnv
- func (app *ObjectEnv) Save(file string, mode os.FileMode) int
- func (app *ObjectEnv) Set(key string, value interface{}) *ObjectEnv
- func (app *ObjectEnv) Size() int
- func (app *ObjectEnv) Unset(key string) bool
- type ParserService
- type Str
- type StrInterface
Constants ¶
View Source
const DefAssignOpt = "=" // 键值分隔符
包常量
View Source
const DefVarExpress = "(\\$\\{([^(\\{\\})]+)\\})" // 动态模版变量匹配
View Source
const LineDiv = "\r\n" // 换行分隔符
Variables ¶
View Source
var SupportExtArr = [2]string{"env", "ini"} // 支持文件后缀
Functions ¶
func ParseKeyValueByExpressStr ¶
解析表达式字符串
func ParseStrLine ¶
换行拆解
Types ¶
type DefaultParser ¶
type DefaultParser struct{}
默认解析器
func (DefaultParser) GetContent ¶
func (_ DefaultParser) GetContent(file string, assignOpt string, varExpress string) (map[string]interface{}, error)
解析器
type FileSchema ¶
type FileSchema interface { IsExist() bool PathInfo() map[string]string IsDir() (bool, error) BaseName() string AbsolutePath() string FileType() string Extension() string }
文件协议
type IEnvironment ¶
type IEnvironment interface { Get(key string, def interface{}) interface{} Set(key string, value interface{}) *ObjectEnv Load(path string) *ObjectEnv }
环境接口
type ObjectEnv ¶
type ObjectEnv struct {
// contains filtered or unexported fields
}
环境变量
var RootEnv *ObjectEnv // 引用根
type ParserService ¶
type ParserService interface {
GetContent(file string, assignOpt string, varExpress string) (map[string]interface{}, error)
}
解析器
type StrInterface ¶
type StrInterface interface { ToString(value interface{}) string StrToAny(value string) interface{} }
字符串 类型
Click to show internal directories.
Click to hide internal directories.