MCPcopy Index your code
hub / github.com/dearcode/candy / getUserInfoByName

Function getUserInfoByName

candy.go:121–145  ·  view source on GitHub ↗
(c *candy.CandyClient, reader *bufio.Reader)

Source from the content-addressed store, hash-verified

119}
120
121func getUserInfoByName(c *candy.CandyClient, reader *bufio.Reader) {
122 fmt.Println("----------------获取用户信息-------------------")
123 defer endSection()
124
125 fmt.Println("请输入用户名:")
126 d, _, _ := reader.ReadLine()
127 userName := string(d)
128
129 data, err := c.GetUserInfoByName(userName)
130 if err != nil {
131 e := candy.ErrorParse(err.Error())
132 log.Errorf("getUserInfo code:%v error:%v", e.Code, e.Msg)
133 return
134 }
135
136 user, err := candy.DecodeUserInfo([]byte(data))
137 if err != nil {
138 e := candy.ErrorParse(err.Error())
139 log.Errorf("Decode UserInfo code:%v error:%v", e.Code, e.Msg)
140 return
141 }
142
143 log.Debugf("getUserInfo success, userName:%v", userName)
144 log.Debugf("user detail, ID:%v Name:%v NickName:%v Avatar:%v", user.ID, user.Name, user.NickName, user.Avatar)
145}
146
147func getUserInfoByID(c *candy.CandyClient, reader *bufio.Reader) {
148 fmt.Println("----------------获取用户信息-------------------")

Callers 1

mainFunction · 0.85

Calls 3

endSectionFunction · 0.85
GetUserInfoByNameMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected