properties

package
v0.9.26 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 7 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format added in v0.9.19

func Format(t Table, options ...FormatOptionsF) string

Format 把 Table 格式化为字符串

func FormatWithGroups added in v0.9.19

func FormatWithGroups(opt *FormatOptions)

FormatWithGroups 启用分组功能

Types

type FormatOptions added in v0.9.19

type FormatOptions struct {
	// contains filtered or unexported fields
}

FormatOptions ...

type FormatOptionsF added in v0.9.19

type FormatOptionsF func(opt *FormatOptions)

FormatOptionsF ...

type Getter added in v0.9.14

type Getter interface {
	Required() Getter
	Optional() Getter
	Error() error

	GetBool(name string, defaultValue ...bool) bool
	GetByte(name string, defaultValue ...byte) byte
	GetRune(name string, defaultValue ...rune) rune
	GetString(name string, defaultValue ...string) string
	GetStringList(name string, defaultValue ...string) []string

	GetFloat32(name string, defaultValue ...float32) float32
	GetFloat64(name string, defaultValue ...float64) float64

	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

	// 根据给出的名称前缀和后缀,列出项目 id
	ListItems(prefix, suffix string) []string
}

Getter 属性值读取器

type Setter added in v0.9.14

type Setter interface {
	SetBool(name string, value bool)
	SetByte(name string, value byte)
	SetRune(name string, value rune)
	SetString(name string, value string)
	SetStringList(name string, value []string)

	SetFloat32(name string, value float32)
	SetFloat64(name string, value float64)

	SetInt(name string, value int)
	SetInt8(name string, value int8)
	SetInt16(name string, value int16)
	SetInt32(name string, value int32)
	SetInt64(name string, value int64)

	SetUint(name string, value uint)
	SetUint8(name string, value uint8)
	SetUint16(name string, value uint16)
	SetUint32(name string, value uint32)
	SetUint64(name string, value uint64)
}

Setter 属性值设置器

type Table

type Table interface {
	Mode() safe.Mode

	Names() []string

	Exists(name string) bool

	Clear()

	Remove(name string) bool

	GetProperty(name string) string
	GetPropertyRequired(name string) (string, error)
	GetPropertyOptional(name string, defaultValue string) string

	SetProperty(name string, value string)

	Export(dst map[string]string) map[string]string

	Import(src map[string]string)

	Getter() Getter
	Setter() Setter
}

Table 表示一个属性的集合

func LoadFromResource added in v0.9.8

func LoadFromResource(path string, res resources.Table, mode safe.Mode) (Table, error)

LoadFromResource 从资源中加载属性表

func NewTable

func NewTable(mode safe.Mode) Table

NewTable 新建属性表

func Parse

func Parse(str string, mode safe.Mode) (Table, error)

Parse 解析属性表

Jump to

Keyboard shortcuts

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