session.go 477 B

1234567891011121314151617181920212223
  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. type Session struct {
  8. ID int64
  9. UserID int64
  10. Token string
  11. CreatedAt time.Time
  12. UserAgent string
  13. IP string
  14. }
  15. func (s *Session) String() string {
  16. return fmt.Sprintf("ID=%d, UserID=%d, IP=%s", s.ID, s.UserID, s.IP)
  17. }
  18. type Sessions []*Session