Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
名称翻译词典 负责在名称和整数ID之间互相翻译 注意名称不能为空,ID从1开始
func (*Dictionary) GetIdFromName ¶
func (d *Dictionary) GetIdFromName(name string) int
从名称得到整数ID 对从未见过的,为其创建新ID并返回,否则直接返回已有ID
func (*Dictionary) GetNameFromId ¶
func (d *Dictionary) GetNameFromId(id int) string
从ID得到名称 如果ID不存在则返回空字符串
func (*Dictionary) MarshalJSON ¶
func (m *Dictionary) MarshalJSON() ([]byte, error)
对Dictionary结构体进行JSON串行化
func (*Dictionary) TranslateIdFromName ¶
func (d *Dictionary) TranslateIdFromName(name string) int
从名称得到整数ID 对从未见过的,返回-1,否则直接返回已有ID
func (*Dictionary) UnmarshalJSON ¶
func (m *Dictionary) UnmarshalJSON(b []byte) error
对Dictionary结构体进行JSON反串行化
type DictionaryJSON ¶
Dictionary结构体JSON串行化/反串行化临时存储结构体
Click to show internal directories.
Click to hide internal directories.