You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
818 B
Go
29 lines
818 B
Go
2 years ago
|
package stt
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestReadFieldName(t *testing.T) {
|
||
|
//str := "type@=chatmsg/a@=false/bbbbbb@=123/c@=cid@AA=xx1@AScnn@AA=xx2@AS/"
|
||
|
//str := "type@=chatmsg/a@=false/bbbbbb@=123/c@=/d@=/"
|
||
|
str := "type@=noble_num_info/sum@=28/vn@=16944/rid@=2947432/list@=lev@AA=8@ASnum@AA=4@AS@Slev@AA=5@ASnum@AA=1@AS@Slev@AA=4@ASnum@AA=3@AS@Slev@AA=3@ASnum@AA=1@AS@Slev@AA=1@ASnum@AA=3@AS@Slev@AA=7@ASnum@AA=16@AS@S/"
|
||
|
//iter := ConfigDefault.BorrowIterator([]byte(str))
|
||
|
//fieldName := iter.ReadFieldName()
|
||
|
var s struct {
|
||
|
//Type string `stt:"type"`
|
||
|
A bool `stt:"a"`
|
||
|
B int32 `stt:"bbbbbb"`
|
||
|
C struct {
|
||
|
Cid string `stt:"cid"`
|
||
|
Cnn string `stt:"cnn"`
|
||
|
} `stt:"c,omitempty"`
|
||
|
}
|
||
|
err := Unmarshal([]byte(str), &s)
|
||
|
fmt.Println(s, err)
|
||
|
|
||
|
ret, err := Marshal(&s)
|
||
|
fmt.Println(string(ret), err)
|
||
|
}
|