golang-im聊天
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 lines
673 B

  1. package model
  2. import (
  3. "gim/pkg/pb"
  4. "time"
  5. )
  6. // User 账户
  7. type User struct {
  8. Id int64 // 用户id
  9. PhoneNumber string // 手机号
  10. Nickname string // 昵称
  11. Sex int32 // 性别,1:男;2:女
  12. AvatarUrl string // 用户头像
  13. Extra string // 附加属性
  14. CreateTime time.Time // 创建时间
  15. UpdateTime time.Time // 更新时间
  16. }
  17. func (u *User) ToProto() *pb.User {
  18. if u == nil {
  19. return nil
  20. }
  21. return &pb.User{
  22. UserId: u.Id,
  23. Nickname: u.Nickname,
  24. Sex: u.Sex,
  25. AvatarUrl: u.AvatarUrl,
  26. Extra: u.Extra,
  27. CreateTime: u.CreateTime.Unix(),
  28. UpdateTime: u.UpdateTime.Unix(),
  29. }
  30. }