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 PropertyGetter
- type PropertySetter
- 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) Getter() PropertyGetter
- func (inst *SimpleProperties) Import(src map[string]string)
- func (inst *SimpleProperties) SetProperty(name string, value string)
- func (inst *SimpleProperties) Setter() PropertySetter
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, defaultValue string)
Clear()
Getter() PropertyGetter
Setter() PropertySetter
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 PropertyGetter ¶ added in v0.0.65
type PropertyGetter interface {
Error() error
SetError(err error)
CleanError()
GetString(name string, defaultValue string) string
GetBool(name string, defaultValue bool) bool
GetInt(name string, defaultValue int) int
GetInt8(name string, defaultValue int8) int8
GetInt16(name string, defaultValue int16) int16
GetInt32(name string, defaultValue int32) int32
GetInt64(name string, defaultValue int64) int64
GetUint(name string, defaultValue uint) uint
GetUint8(name string, defaultValue uint8) uint8
GetUint16(name string, defaultValue uint16) uint16
GetUint32(name string, defaultValue uint32) uint32
GetUint64(name string, defaultValue uint64) uint64
GetFloat32(name string, defaultValue float32) float32
GetFloat64(name string, defaultValue float64) float64
}
PropertyGetter 接口用来获取 Properties 中的属性
type PropertySetter ¶ added in v0.0.65
type PropertySetter interface {
SetString(name string, defaultValue string)
SetBool(name string, defaultValue bool)
SetInt(name string, defaultValue int)
SetInt8(name string, defaultValue int8)
SetInt16(name string, defaultValue int16)
SetInt32(name string, defaultValue int32)
SetInt64(name string, defaultValue int64)
SetUint(name string, defaultValue uint)
SetUint8(name string, defaultValue uint8)
SetUint16(name string, defaultValue uint16)
SetUint32(name string, defaultValue uint32)
SetUint64(name string, defaultValue uint64)
SetFloat32(name string, defaultValue float32)
SetFloat64(name string, defaultValue float64)
}
PropertySetter 接口用来设置 Properties 中的属性
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) Getter ¶ added in v0.0.65
func (inst *SimpleProperties) Getter() PropertyGetter
Getter 取 Getter
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 给集合中指定的键值对赋值
func (*SimpleProperties) Setter ¶ added in v0.0.65
func (inst *SimpleProperties) Setter() PropertySetter
Setter 取 Setter
Source Files
¶
- arguments.go
- attributes.go
- embed_resources.go
- environment.go
- parameters.go
- properties.go
- releasepool.go
- resources.go
- simple_arguments.go
- simple_attributes.go
- simple_environment.go
- simple_parameters.go
- simple_properties.go
- simple_properties_formatter.go
- simple_properties_getter.go
- simple_properties_parser.go
- simple_properties_setter.go
- simple_resources.go
Click to show internal directories.
Click to hide internal directories.