session_single.go 622 B

1234567891011121314151617181920212223
  1. package models
  2. import (
  3. "strings"
  4. "time"
  5. )
  6. // SessionSingle 一对一会话表
  7. type SessionSingle struct {
  8. ID string `gorm:"column:id;primary_key"`
  9. TargetUserID string `gorm:"column:target_user_id;NOT NULL"`
  10. ToUserID string `gorm:"column:to_user_id;NOT NULL"`
  11. CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP;NOT NULL"`
  12. UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;NOT NULL"`
  13. }
  14. func (m *SessionSingle) TableName() string {
  15. return "tb_session_single"
  16. }
  17. func IsSessionSingle(id string) bool {
  18. return strings.Contains(id, "SINGLE_")
  19. }