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

Method FindUser

client/candy.go:254–276  ·  view source on GitHub ↗

FindUser 支持模糊查询,返回对应用户的列表

(user string)

Source from the content-addressed store, hash-verified

252
253// FindUser 支持模糊查询,返回对应用户的列表
254func (c *CandyClient) FindUser(user string) (string, error) {
255 req := &meta.GateFindUserRequest{User: user}
256 resp, err := c.api.FindUser(context.Background(), req)
257 if err != nil {
258 return emptyString, err
259 }
260
261 var users []*UserInfo
262 for _, matchUser := range resp.Users {
263 userInfo, err := c.getUserInfoByName(matchUser)
264 if err != nil {
265 return emptyString, err
266 }
267 users = append(users, userInfo)
268 }
269 userList := &UserList{Users: users}
270 data, err := encodeJSON(userList)
271 if err != nil {
272 return emptyString, err
273 }
274
275 return string(data), resp.Header.Error()
276}
277
278// FileExist 判断文件是否存在
279func (c *CandyClient) FileExist(key string) (bool, error) {

Callers

nothing calls this directly

Calls 4

getUserInfoByNameMethod · 0.95
encodeJSONFunction · 0.85
FindUserMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected