Documentation ¶
Index ¶
- type HttpResponse
- type SessionProvider
- func (s *SessionProvider) SessionAll(ctx context.Context) int
- func (s *SessionProvider) SessionDestroy(ctx context.Context, sid string) error
- func (s *SessionProvider) SessionExist(ctx context.Context, sid string) (bool, error)
- func (s *SessionProvider) SessionGC(ctx context.Context)
- func (s *SessionProvider) SessionInit(ctx context.Context, gclifetime int64, config string) error
- func (s *SessionProvider) SessionRead(ctx context.Context, sid string) (session.Store, error)
- func (s *SessionProvider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error)
- type SessionStore
- func (s *SessionStore) Delete(ctx context.Context, key interface{}) error
- func (s *SessionStore) Flush(ctx context.Context) error
- func (s *SessionStore) Get(ctx context.Context, key interface{}) interface{}
- func (s *SessionStore) SessionID(ctx context.Context) string
- func (s *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)
- func (s *SessionStore) Set(ctx context.Context, key, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpResponse ¶
type HttpResponse struct { StatusCode int // contains filtered or unexported fields }
HttpResponse mock response, which should be used in tests
func NewMockContext ¶
func NewMockContext(req *http.Request) (*beegoCtx.Context, *HttpResponse)
func NewMockHttpResponse ¶
func NewMockHttpResponse() *HttpResponse
NewMockHttpResponse you should only use this in your test code
func (*HttpResponse) BodyToString ¶
func (m *HttpResponse) BodyToString() string
BodyToString return the body as the string
func (*HttpResponse) JsonUnmarshal ¶
func (m *HttpResponse) JsonUnmarshal(value interface{}) error
JsonUnmarshal convert the body to object
func (*HttpResponse) Reset ¶
func (m *HttpResponse) Reset()
Reset will reset the status to init status Usually, you want to reuse this instance you may need to call Reset
func (*HttpResponse) Write ¶
func (m *HttpResponse) Write(bytes []byte) (int, error)
Write append the body
func (*HttpResponse) WriteHeader ¶
func (m *HttpResponse) WriteHeader(statusCode int)
WriteHeader set the status code
type SessionProvider ¶
type SessionProvider struct {
Store *SessionStore
}
SessionProvider will replace session provider with "mock" provider
func NewSessionProvider ¶
func NewSessionProvider(name string) *SessionProvider
NewSessionProvider create new SessionProvider and you could use it to mock data Parameter "name" is the real SessionProvider you used
func (*SessionProvider) SessionAll ¶
func (s *SessionProvider) SessionAll(ctx context.Context) int
SessionAll return 0
func (*SessionProvider) SessionDestroy ¶
func (s *SessionProvider) SessionDestroy(ctx context.Context, sid string) error
SessionDestroy reset Store to nil
func (*SessionProvider) SessionExist ¶
SessionExist always return true
func (*SessionProvider) SessionGC ¶
func (s *SessionProvider) SessionGC(ctx context.Context)
SessionGC do nothing
func (*SessionProvider) SessionInit ¶
SessionInit do nothing
func (*SessionProvider) SessionRead ¶
SessionRead return Store
func (*SessionProvider) SessionRegenerate ¶
func (s *SessionProvider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error)
SessionRegenerate create new Store
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
func (*SessionStore) Delete ¶
func (s *SessionStore) Delete(ctx context.Context, key interface{}) error
func (*SessionStore) Get ¶
func (s *SessionStore) Get(ctx context.Context, key interface{}) interface{}
func (*SessionStore) SessionRelease ¶
func (s *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)
SessionRelease do nothing