mock

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockContext

func NewMockContext(req *http.Request) (*rungoCtx.Context, *httptest.ResponseRecorder)

Types

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

func (s *SessionProvider) SessionExist(ctx context.Context, sid string) (bool, error)

SessionExist always return true

func (*SessionProvider) SessionGC

func (s *SessionProvider) SessionGC(ctx context.Context)

SessionGC do nothing

func (*SessionProvider) SessionInit

func (s *SessionProvider) SessionInit(ctx context.Context, gclifetime int64, config string) error

SessionInit do nothing

func (*SessionProvider) SessionRead

func (s *SessionProvider) SessionRead(ctx context.Context, sid string) (session.Store, error)

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) Flush

func (s *SessionStore) Flush(ctx context.Context) error

func (*SessionStore) Get

func (s *SessionStore) Get(ctx context.Context, key interface{}) interface{}

func (*SessionStore) SessionID

func (s *SessionStore) SessionID(ctx context.Context) string

func (*SessionStore) SessionRelease

func (s *SessionStore) SessionRelease(_ context.Context, _ http.ResponseWriter)

SessionRelease do nothing

func (*SessionStore) SessionReleaseIfPresent

func (*SessionStore) SessionReleaseIfPresent(_ context.Context, _ http.ResponseWriter)

SessionReleaseIfPresent do nothing

func (*SessionStore) Set

func (s *SessionStore) Set(ctx context.Context, key, value interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL