davsessions

package
v0.0.0-...-059fb3b Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCredentials = errors.New("invalid credentials")
	ErrUserIDNotMatching  = errors.New("user ids are not matching")
	ErrInvalidSpaceID     = errors.New("invalid spaceID")
)
View Source
var DavSessionRegexp = regexp.MustCompile("^[0-9a-zA-Z- ]+$")
View Source
var ExampleAliceSession = DavSession{
	// contains filtered or unexported fields
}
View Source
var ExampleAliceSession2 = DavSession{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type CreateCmd

type CreateCmd struct {
	Name     string
	Username string
	UserID   uuid.UUID
	SpaceID  uuid.UUID
}

func (CreateCmd) Validate

func (t CreateCmd) Validate() error

type DavSession

type DavSession struct {
	// contains filtered or unexported fields
}

func (*DavSession) CreatedAt

func (u *DavSession) CreatedAt() time.Time

func (*DavSession) ID

func (u *DavSession) ID() uuid.UUID

func (DavSession) Name

func (u DavSession) Name() string

func (*DavSession) SpaceID

func (u *DavSession) SpaceID() uuid.UUID

func (*DavSession) UserID

func (u *DavSession) UserID() uuid.UUID

func (*DavSession) Username

func (u *DavSession) Username() string

type DeleteCmd

type DeleteCmd struct {
	UserID    uuid.UUID
	SessionID uuid.UUID
}

func (DeleteCmd) Validate

func (t DeleteCmd) Validate() error

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() *DavSession

func (*FakeSessionBuilder) CreatedAt

func (f *FakeSessionBuilder) CreatedAt(at time.Time) *FakeSessionBuilder

func (*FakeSessionBuilder) CreatedBy

func (f *FakeSessionBuilder) CreatedBy(user *users.User) *FakeSessionBuilder

func (*FakeSessionBuilder) WithName

func (f *FakeSessionBuilder) WithName(name string) *FakeSessionBuilder

func (*FakeSessionBuilder) WithPassword

func (f *FakeSessionBuilder) WithPassword(password string) *FakeSessionBuilder

func (*FakeSessionBuilder) WithSpace

func (f *FakeSessionBuilder) WithSpace(space *spaces.Space) *FakeSessionBuilder

func (*FakeSessionBuilder) WithUsername

func (f *FakeSessionBuilder) WithUsername(username string) *FakeSessionBuilder

type MockService

type MockService struct {
	mock.Mock
}

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

func (_m *MockService) Authenticate(ctx context.Context, username string, password secret.Text) (*DavSession, error)

Authenticate provides a mock function with given fields: ctx, username, password

func (*MockService) Create

func (_m *MockService) Create(ctx context.Context, cmd *CreateCmd) (*DavSession, string, error)

Create provides a mock function with given fields: ctx, cmd

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

func (_m *MockService) DeleteAll(ctx context.Context, userID uuid.UUID) error

DeleteAll provides a mock function with given fields: ctx, userID

func (*MockService) GetAllForUser

func (_m *MockService) GetAllForUser(ctx context.Context, userID uuid.UUID, paginateCmd *sqlstorage.PaginateCmd) ([]DavSession, error)

GetAllForUser provides a mock function with given fields: ctx, userID, paginateCmd

type Service

type Service interface {
	GetAllForUser(ctx context.Context, userID uuid.UUID, paginateCmd *sqlstorage.PaginateCmd) ([]DavSession, error)
	Create(ctx context.Context, cmd *CreateCmd) (*DavSession, string, error)
	Authenticate(ctx context.Context, username string, password secret.Text) (*DavSession, error)
	Delete(ctx context.Context, cmd *DeleteCmd) error
	DeleteAll(ctx context.Context, userID uuid.UUID) error
}

func Init

func Init(db *sql.DB, spaces spaces.Service, tools tools.Tools) Service

Jump to

Keyboard shortcuts

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