Documentation
¶
Index ¶
- func FormatProperties(tab Properties) string
- func FormatPropertiesWithSegment(tab Properties) string
- type ArgumentReader
- type Arguments
- type Attributes
- type Atts
- type Environment
- type Parameters
- type Properties
- type Res
- type Resource
- type Resources
- type SimpleArguments
- type SimpleAttributes
- func (inst *SimpleAttributes) Export(dst map[string]lang.Object) map[string]lang.Object
- func (inst *SimpleAttributes) GetAttribute(name string) lang.Object
- func (inst *SimpleAttributes) GetAttributeRequired(name string) (lang.Object, error)
- func (inst *SimpleAttributes) Import(src map[string]lang.Object)
- func (inst *SimpleAttributes) SetAttribute(name string, value lang.Object)
- type SimpleEnvironment
- type SimpleParameters
- type SimpleProperties
- func (inst *SimpleProperties) Clear()
- func (inst *SimpleProperties) Export(dst map[string]string) map[string]string
- func (inst *SimpleProperties) GetProperty(name string, defaultValue string) string
- func (inst *SimpleProperties) GetPropertyRequired(name string) (string, error)
- func (inst *SimpleProperties) Import(src map[string]string)
- func (inst *SimpleProperties) SetProperty(name string, value string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatPropertiesWithSegment ¶
func FormatPropertiesWithSegment(tab Properties) string
FormatPropertiesWithSegment 将属性表格式化为文本形式(支持分段)
Types ¶
type ArgumentReader ¶ added in v0.0.14
type Arguments ¶
type Arguments interface {
GetReader(flag string) (ArgumentReader, bool)
Import([]string)
Export() []string
}
func CreateArguments ¶
func CreateArguments() Arguments
type Attributes ¶
type Attributes interface {
Atts
GetAttributeRequired(name string) (lang.Object, error)
Import(map[string]lang.Object)
Export(map[string]lang.Object) map[string]lang.Object
}
func CreateAttributes ¶
func CreateAttributes() Attributes
type Environment ¶
type Environment interface {
GetEnv(name string) (string, error)
SetEnv(name string, value string)
Import(map[string]string)
Export(map[string]string) map[string]string
}
func CreateEnvironment ¶
func CreateEnvironment() Environment
type Parameters ¶
type Parameters interface {
GetParam(name string) (string, error)
Import(map[string]string)
Export(map[string]string) map[string]string
}
func CreateParameters ¶
func CreateParameters() Parameters
type Properties ¶
type Properties interface {
GetPropertyRequired(name string) (string, error)
GetProperty(name string, defaultValue string) string
SetProperty(name string, value string)
Clear()
Export(map[string]string) map[string]string
Import(map[string]string)
}
Properties 接口表示对属性列表的引用。
func CreateProperties ¶
func CreateProperties() Properties
func ParseProperties ¶
func ParseProperties(text string, container Properties) (Properties, error)
ParseProperties 函数把参数 text 解析为属性表,存入dest中。
type Res ¶ added in v0.0.33
type Res interface {
// 加载文本
ReadText() (string, error)
// 加载二进制数据
ReadBinary() ([]byte, error)
// 读数据流
Reader() (io.ReadCloser, error)
// 取长度
Length() int64
IsFile() bool
IsDir() bool
Exists() bool
}
Res 接口代表一个资源实体
type Resource ¶ added in v0.0.33
type Resource struct {
Name string
AbsolutePath string
RelativePath string
BasePath string
IsDir bool
}
Resource 结构包含某个资源的信息
type Resources ¶
type Resources interface {
// 加载文本数据
GetText(path string) (string, error)
// 加载二进制数据
GetBinary(path string) ([]byte, error)
// 读数据流
GetReader(path string) (io.ReadCloser, error)
// 列出所有资源的路径, 相当于{{ List("/",true) }}
All() []*Resource
// 列出所有资源的路径
List(path string, recursive bool) []*Resource
Get(path string) (Res, error)
Clear()
Import(src map[string]Res, override bool)
Export(dst map[string]Res) map[string]Res
}
Resources 接口提供一组获取资源的方法
type SimpleArguments ¶
type SimpleArguments struct {
// contains filtered or unexported fields
}
func (*SimpleArguments) Export ¶
func (inst *SimpleArguments) Export() []string
func (*SimpleArguments) GetReader ¶ added in v0.0.14
func (inst *SimpleArguments) GetReader(flag string) (ArgumentReader, bool)
func (*SimpleArguments) Import ¶
func (inst *SimpleArguments) Import(args []string)
type SimpleAttributes ¶
type SimpleAttributes struct {
// contains filtered or unexported fields
}
func (*SimpleAttributes) GetAttribute ¶
func (inst *SimpleAttributes) GetAttribute(name string) lang.Object
func (*SimpleAttributes) GetAttributeRequired ¶ added in v0.0.3
func (inst *SimpleAttributes) GetAttributeRequired(name string) (lang.Object, error)
func (*SimpleAttributes) SetAttribute ¶ added in v0.0.3
func (inst *SimpleAttributes) SetAttribute(name string, value lang.Object)
type SimpleEnvironment ¶
type SimpleEnvironment struct {
// contains filtered or unexported fields
}
func (*SimpleEnvironment) Export ¶
func (inst *SimpleEnvironment) Export(dst map[string]string) map[string]string
func (*SimpleEnvironment) GetEnv ¶
func (inst *SimpleEnvironment) GetEnv(name string) (string, error)
func (*SimpleEnvironment) Import ¶
func (inst *SimpleEnvironment) Import(src map[string]string)
func (*SimpleEnvironment) SetEnv ¶
func (inst *SimpleEnvironment) SetEnv(name string, value string)
type SimpleParameters ¶
type SimpleParameters struct {
}
func (*SimpleParameters) Export ¶
func (inst *SimpleParameters) Export(table map[string]string) map[string]string
func (*SimpleParameters) GetParam ¶
func (inst *SimpleParameters) GetParam(name string) (string, error)
func (*SimpleParameters) Import ¶
func (inst *SimpleParameters) Import(src map[string]string)
type SimpleProperties ¶
type SimpleProperties struct {
// contains filtered or unexported fields
}
SimpleProperties 实现一个简单的 Properties 集合
func (*SimpleProperties) Export ¶
func (inst *SimpleProperties) Export(dst map[string]string) map[string]string
Export 把本集合中的所有键值对导出
func (*SimpleProperties) GetProperty ¶
func (inst *SimpleProperties) GetProperty(name string, defaultValue string) string
GetProperty 在集合中取指定的值,如果没有则返回默认值
func (*SimpleProperties) GetPropertyRequired ¶
func (inst *SimpleProperties) GetPropertyRequired(name string) (string, error)
GetPropertyRequired 在集合中取指定的值,如果没有则返回error
func (*SimpleProperties) Import ¶
func (inst *SimpleProperties) Import(src map[string]string)
Import 把参数 src 中的所有键值对导入本集合,保留原有内容(如果没有被覆盖)
func (*SimpleProperties) SetProperty ¶
func (inst *SimpleProperties) SetProperty(name string, value string)
SetProperty 给集合中指定的键值对赋值
Source Files
¶
Click to show internal directories.
Click to hide internal directories.