user_session.go 623 B

12345678910111213141516171819202122232425
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package model
  5. import "time"
  6. import "fmt"
  7. // UserSession represents a user session in the system.
  8. type UserSession struct {
  9. ID int64
  10. UserID int64
  11. Token string
  12. CreatedAt time.Time
  13. UserAgent string
  14. IP string
  15. }
  16. func (s *UserSession) String() string {
  17. return fmt.Sprintf(`ID="%d", UserID="%d", IP="%s", Token="%s"`, s.ID, s.UserID, s.IP, s.Token)
  18. }
  19. // UserSessions represents a list of sessions.
  20. type UserSessions []*UserSession