roomAdmin.go 775 B

12345678910111213141516171819202122232425262728293031323334
  1. package model
  2. import xtime "go-common/library/time"
  3. // TableName is used to identify table name in gorm
  4. func (ra *RoomAdmin) TableName() string {
  5. return "ap_room_admin"
  6. }
  7. // RoomAdmin .
  8. type RoomAdmin struct {
  9. Id int64 `json:"id" gorm:"column:id"`
  10. Uid int64 `json:"uid" gorm:"column:uid"`
  11. Roomid int64 `json:"roomid" gorm:"column:roomid"`
  12. Ctime xtime.Time `json:"ctime" gorm:"comumn:ctime"`
  13. }
  14. // RoomAdmins multi RoomAdmin .
  15. type RoomAdmins []*RoomAdmin
  16. // Len returns length of RoomAdmins.
  17. func (ras RoomAdmins) Len() int {
  18. return len(ras)
  19. }
  20. // Swap .
  21. func (ras RoomAdmins) Swap(i, j int) {
  22. ras[i], ras[j] = ras[j], ras[i]
  23. }
  24. // Less returns sorting rule.
  25. func (ras RoomAdmins) Less(i, j int) bool {
  26. return ras[i].Ctime < ras[j].Ctime
  27. }