Documentation ¶
Index ¶
- Constants
- func ParseToken(val string) (userID string, token string, err error)
- type EndSession
- type NewSession
- type Session
- func (u *Session) Expired() bool
- func (u Session) Fields() map[string]interface{}
- func (u Session) SessionFields() map[string]interface{}
- func (u Session) SessionToken() string
- func (u Session) Table() string
- func (u Session) ValidateToken(token string) bool
- func (u *Session) WithFields(fields map[string]interface{}) error
Constants ¶
View Source
const ( // UniqueIndex defines the unique index name used by the models db for model query optimization. UniqueIndex = "user_id" // UniqueIndexField defines the unique index field used by the model in it's field. UniqueIndexField = "user_public_id" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EndSession ¶
EndSession defines the set of data received to end a user's session.
type NewSession ¶
NewSession defines the set of data received to create a new user's session.
type Session ¶
type Session struct { UserID string `json:"user_id"` PublicID string `json:"public_id"` Token string `json:"token"` Expires time.Time `json:"expires"` }
Session defines a struct which holds the the details of a giving user session.
func (Session) SessionFields ¶
SessionFields returns a map representing the user session.
func (Session) SessionToken ¶
SessionToken returns the Session.Token has a base64 encoded string. It returns a base64 encoded version where it contains the UserID:SessionToken.
func (Session) ValidateToken ¶
ValidateToken validates the provide base64 encoded token, that it matches the expected token value with that of the session.
func (*Session) WithFields ¶
WithFields attempts to syncing the giving data within the provided map into it's own fields.
Click to show internal directories.
Click to hide internal directories.