Documentation ¶
Index ¶
- Variables
- type CreateCmd
- type DeleteCmd
- type FakeSessionBuilder
- func (f *FakeSessionBuilder) Build() *Session
- func (f *FakeSessionBuilder) CreatedAt(at time.Time) *FakeSessionBuilder
- func (f *FakeSessionBuilder) CreatedBy(user *users.User) *FakeSessionBuilder
- func (f *FakeSessionBuilder) WithDevice(device string) *FakeSessionBuilder
- func (f *FakeSessionBuilder) WithIP(ip string) *FakeSessionBuilder
- func (f *FakeSessionBuilder) WithToken(token string) *FakeSessionBuilder
- type MockService
- func (_m *MockService) Create(ctx context.Context, cmd *CreateCmd) (*Session, error)
- func (_m *MockService) Delete(ctx context.Context, cmd *DeleteCmd) error
- func (_m *MockService) DeleteAll(ctx context.Context, userID uuid.UUID) error
- func (_m *MockService) GetAllForUser(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Session, error)
- func (_m *MockService) GetByToken(ctx context.Context, token secret.Text) (*Session, error)
- func (_m *MockService) GetFromReq(r *http.Request) (*Session, error)
- func (_m *MockService) Logout(r *http.Request, w http.ResponseWriter) error
- type Service
- type Session
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingSessionToken = errors.New("missing session token") ErrSessionNotFound = errors.New("session not found") )
View Source
var ( AliceWebSessionExample = Session{ // contains filtered or unexported fields } BobWebSessionExample = Session{ // contains filtered or unexported fields } )
View Source
var ErrUserIDNotMatching = errors.New("user ids are not matching")
Functions ¶
This section is empty.
Types ¶
type FakeSessionBuilder ¶
type FakeSessionBuilder struct {
// contains filtered or unexported fields
}
func NewFakeSession ¶
func NewFakeSession(t *testing.T) *FakeSessionBuilder
func (*FakeSessionBuilder) Build ¶
func (f *FakeSessionBuilder) Build() *Session
func (*FakeSessionBuilder) CreatedAt ¶
func (f *FakeSessionBuilder) CreatedAt(at time.Time) *FakeSessionBuilder
func (*FakeSessionBuilder) CreatedBy ¶
func (f *FakeSessionBuilder) CreatedBy(user *users.User) *FakeSessionBuilder
func (*FakeSessionBuilder) WithDevice ¶
func (f *FakeSessionBuilder) WithDevice(device string) *FakeSessionBuilder
func (*FakeSessionBuilder) WithIP ¶
func (f *FakeSessionBuilder) WithIP(ip string) *FakeSessionBuilder
func (*FakeSessionBuilder) WithToken ¶
func (f *FakeSessionBuilder) WithToken(token string) *FakeSessionBuilder
type MockService ¶
MockService is an autogenerated mock type for the Service type
func NewMockService ¶
func NewMockService(t interface { mock.TestingT Cleanup(func()) }) *MockService
NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockService) Delete ¶
func (_m *MockService) Delete(ctx context.Context, cmd *DeleteCmd) error
Delete provides a mock function with given fields: ctx, cmd
func (*MockService) GetAllForUser ¶
func (_m *MockService) GetAllForUser(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Session, error)
GetAllForUser provides a mock function with given fields: ctx, userID, cmd
func (*MockService) GetByToken ¶
GetByToken provides a mock function with given fields: ctx, token
func (*MockService) GetFromReq ¶
func (_m *MockService) GetFromReq(r *http.Request) (*Session, error)
GetFromReq provides a mock function with given fields: r
func (*MockService) Logout ¶
func (_m *MockService) Logout(r *http.Request, w http.ResponseWriter) error
Logout provides a mock function with given fields: r, w
type Service ¶
type Service interface { Create(ctx context.Context, cmd *CreateCmd) (*Session, error) GetByToken(ctx context.Context, token secret.Text) (*Session, error) GetFromReq(r *http.Request) (*Session, error) Logout(r *http.Request, w http.ResponseWriter) error GetAllForUser(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Session, error) Delete(ctx context.Context, cmd *DeleteCmd) error DeleteAll(ctx context.Context, userID uuid.UUID) error }
Click to show internal directories.
Click to hide internal directories.