bloat/model/session.go

26 lines
505 B
Go
Raw Normal View History

2019-12-13 18:08:26 +00:00
package model
import (
"errors"
)
2019-12-13 18:08:26 +00:00
var (
ErrSessionNotFound = errors.New("session not found")
)
type Session struct {
ID string `json:"id"`
InstanceDomain string `json:"instance_domain"`
AccessToken string `json:"access_token"`
2019-12-13 18:08:26 +00:00
}
type SessionRepository interface {
Add(session Session) (err error)
Update(sessionID string, accessToken string) (err error)
Get(sessionID string) (session Session, err error)
}
func (s Session) IsLoggedIn() bool {
return len(s.AccessToken) > 0
}