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

Function register

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

Source from the content-addressed store, hash-verified

42}
43
44func register(c *candy.CandyClient, reader *bufio.Reader) {
45 fmt.Println("----------------用户注册-----------------------")
46 defer endSection()
47
48 fmt.Println("请输入用户名:")
49 data, _, _ := reader.ReadLine()
50 userName := string(data)
51 fmt.Println("请输入密码:")
52 data, _, _ = reader.ReadLine()
53 userPassword := string(data)
54
55 id, err := c.Register(userName, userPassword)
56 if err != nil {
57 e := candy.ErrorParse(err.Error())
58 log.Errorf("Register code:%v error:%v", e.Code, e.Msg)
59 return
60 }
61
62 log.Debugf("Register success, userID:%v userName:%v userPassword:%v", id, userName, userPassword)
63}
64
65func login(c *candy.CandyClient, reader *bufio.Reader) {
66 fmt.Println("----------------用户登陆-----------------------")

Callers 1

mainFunction · 0.85

Calls 3

endSectionFunction · 0.85
RegisterMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected