map增加toString
This commit is contained in:
parent
1a7414bb75
commit
0c8a013bdb
@ -38,4 +38,6 @@ type EasyMap interface {
|
||||
Iterator(IteratorFunc)
|
||||
// ToStruct 转换成结构体
|
||||
ToStruct(receiver interface{}) error
|
||||
// ToString 转为字符串
|
||||
ToString() string
|
||||
}
|
||||
|
11
normal.go
11
normal.go
@ -327,3 +327,14 @@ func (n *normal) ToStruct(receiver interface{}) error {
|
||||
decoder.UseNumber()
|
||||
return decoder.Decode(receiver)
|
||||
}
|
||||
|
||||
// ToString 转字符串
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 20:44 2023/8/15
|
||||
func (n *normal) ToString() string {
|
||||
mapData := n.GetAll()
|
||||
byteData, _ := json.Marshal(mapData)
|
||||
return string(byteData)
|
||||
}
|
||||
|
11
segment.go
11
segment.go
@ -200,3 +200,14 @@ func (s *segment) ToStruct(receiver interface{}) error {
|
||||
decoder.UseNumber()
|
||||
return decoder.Decode(receiver)
|
||||
}
|
||||
|
||||
// ToString 转字符串
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 20:44 2023/8/15
|
||||
func (s *segment) ToString() string {
|
||||
mapData := s.GetAll()
|
||||
byteData, _ := json.Marshal(mapData)
|
||||
return string(byteData)
|
||||
}
|
||||
|
@ -269,3 +269,14 @@ func (s *syncMap) ToStruct(receiver interface{}) error {
|
||||
decoder.UseNumber()
|
||||
return decoder.Decode(receiver)
|
||||
}
|
||||
|
||||
// ToString 转字符串
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 20:44 2023/8/15
|
||||
func (s *syncMap) ToString() string {
|
||||
mapData := s.GetAll()
|
||||
byteData, _ := json.Marshal(mapData)
|
||||
return string(byteData)
|
||||
}
|
||||
|
@ -176,3 +176,14 @@ func (s *segmentSync) ToStruct(receiver interface{}) error {
|
||||
decoder.UseNumber()
|
||||
return decoder.Decode(receiver)
|
||||
}
|
||||
|
||||
// ToString 转字符串
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 20:44 2023/8/15
|
||||
func (s *segmentSync) ToString() string {
|
||||
mapData := s.GetAll()
|
||||
byteData, _ := json.Marshal(mapData)
|
||||
return string(byteData)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user