Documentation
¶
Index ¶
- Constants
- Variables
- type CheckoutSession
- type Flash
- type Level
- type Service
- func (s *Service) ClearCheckoutSession() error
- func (s *Service) ClearUserSession() error
- func (s *Service) Close()
- func (s *Service) GetCheckoutSession() (*CheckoutSession, error)
- func (s *Service) GetFlashMessage() (*Flash, error)
- func (s *Service) GetUserSession() (*UserSession, error)
- func (s *Service) SetCheckoutSession(checkoutSession *CheckoutSession) error
- func (s *Service) SetFlashMessage(flash *Flash) error
- func (s *Service) SetSessionService(r *http.Request, w http.ResponseWriter)
- func (s *Service) SetUserSession(userSession *UserSession) error
- func (s *Service) StartSession() error
- type ServiceInterface
- type UserSession
Constants ¶
const ( LogLevelUnspecified Level = "Unspecified" LogLevelTrace = "Trace" LogLevelInfo = "Info" LogLevelWarning = "Warning" LogLevelError = "Error" )
Variables ¶
var ( // StorageSessionName ... StorageSessionName = "go_oauth2_server_session" // UserSessionKey ... UserSessionKey = "go_oauth2_server_user" // CheckoutSessionKey ... CheckoutSessionKey = "go_oauth2_server_checkout" // ErrSessonNotStarted ... ErrSessonNotStarted = errors.New("Session not started") )
Functions ¶
This section is empty.
Types ¶
type CheckoutSession ¶
type CheckoutSession struct { ID string // stripe checkout session id Products []config.Product // stripe products }
CheckoutSession has stripe checkout data
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service wraps session functionality
func NewService ¶
NewService returns a new Service instance
func (*Service) ClearCheckoutSession ¶
ClearCheckoutSession deletes the checkout session
func (*Service) ClearUserSession ¶
ClearUserSession deletes the user session
func (*Service) GetCheckoutSession ¶
func (s *Service) GetCheckoutSession() (*CheckoutSession, error)
GetCheckoutSession returns the checkout session
func (*Service) GetFlashMessage ¶
GetFlashMessage returns the first flash message
func (*Service) GetUserSession ¶
func (s *Service) GetUserSession() (*UserSession, error)
GetUserSession returns the user session
func (*Service) SetCheckoutSession ¶
func (s *Service) SetCheckoutSession(checkoutSession *CheckoutSession) error
SetCheckoutSession saves the checkout session
func (*Service) SetFlashMessage ¶
SetFlashMessage sets a flash message, useful for displaying an error after 302 redirection
func (*Service) SetSessionService ¶
func (s *Service) SetSessionService(r *http.Request, w http.ResponseWriter)
SetSessionService sets the request and responseWriter on the session service
func (*Service) SetUserSession ¶
func (s *Service) SetUserSession(userSession *UserSession) error
SetUserSession saves the user session
func (*Service) StartSession ¶
StartSession starts a new session. This method must be called before other public methods of this struct as it sets the internal session object
type ServiceInterface ¶
type ServiceInterface interface { SetSessionService(r *http.Request, w http.ResponseWriter) StartSession() error GetUserSession() (*UserSession, error) SetUserSession(userSession *UserSession) error GetCheckoutSession() (*CheckoutSession, error) SetCheckoutSession(userSession *CheckoutSession) error ClearCheckoutSession() error ClearUserSession() error SetFlashMessage(flash *Flash) error GetFlashMessage() (*Flash, error) Close() }
ServiceInterface defines exported methods