spaces

package
v0.0.0-...-46baba5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const BootstrapSpaceName = "Everyone"

Variables

View Source
var (
	ErrRootFSNotFound     = errors.New("rootFS not found")
	ErrRootFSExist        = errors.New("rootFS exists")
	ErrInvalidRootFS      = errors.New("invalid rootFS")
	ErrNotFound           = errors.New("space not found")
	ErrInvalidSpaceAccess = errors.New("no access to space")
)
View Source
var ExampleAliceBobSharedSpace = Space{
	// contains filtered or unexported fields
}
View Source
var ExampleAlicePersonalSpace = Space{
	// contains filtered or unexported fields
}
View Source
var ExampleBobPersonalSpace = Space{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type AddOwnerCmd

type AddOwnerCmd struct {
	User    *users.User
	Owner   *users.User
	SpaceID uuid.UUID
}

func (AddOwnerCmd) Validate

func (t AddOwnerCmd) Validate() error

Validate the fields.

type CreateCmd

type CreateCmd struct {
	User   *users.User
	Name   string
	Owners []uuid.UUID
}

func (CreateCmd) Validate

func (t CreateCmd) Validate() error

Validate the fields.

type FakeSpaceBuilder

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

func NewFakeSpace

func NewFakeSpace(t *testing.T) *FakeSpaceBuilder

func (*FakeSpaceBuilder) Build

func (f *FakeSpaceBuilder) Build() *Space

func (*FakeSpaceBuilder) BuildAndStore

func (f *FakeSpaceBuilder) BuildAndStore(ctx context.Context, db sqlstorage.Querier) *Space

func (*FakeSpaceBuilder) CreatedAt

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

func (*FakeSpaceBuilder) CreatedBy

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

func (*FakeSpaceBuilder) WithName

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

func (*FakeSpaceBuilder) WithOwners

func (f *FakeSpaceBuilder) WithOwners(users ...users.User) *FakeSpaceBuilder

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

func (_m *MockService) AddOwner(ctx context.Context, cmd *AddOwnerCmd) (*Space, error)

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

func (*MockService) Bootstrap

func (_m *MockService) Bootstrap(ctx context.Context, user *users.User) error

Bootstrap provides a mock function with given fields: ctx, user

func (*MockService) Create

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

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

func (*MockService) Delete

func (_m *MockService) Delete(ctx context.Context, user *users.User, spaceID uuid.UUID) error

Delete provides a mock function with given fields: ctx, user, spaceID

func (*MockService) GetAllSpaces

func (_m *MockService) GetAllSpaces(ctx context.Context, user *users.User, cmd *sqlstorage.PaginateCmd) ([]Space, error)

GetAllSpaces provides a mock function with given fields: ctx, user, cmd

func (*MockService) GetAllUserSpaces

func (_m *MockService) GetAllUserSpaces(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Space, error)

GetAllUserSpaces provides a mock function with given fields: ctx, userID, cmd

func (*MockService) GetByID

func (_m *MockService) GetByID(ctx context.Context, spaceID uuid.UUID) (*Space, error)

GetByID provides a mock function with given fields: ctx, spaceID

func (*MockService) GetUserSpace

func (_m *MockService) GetUserSpace(ctx context.Context, userID uuid.UUID, spaceID uuid.UUID) (*Space, error)

GetUserSpace provides a mock function with given fields: ctx, userID, spaceID

func (*MockService) RemoveOwner

func (_m *MockService) RemoveOwner(ctx context.Context, cmd *RemoveOwnerCmd) (*Space, error)

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

type Owners

type Owners []uuid.UUID

func (*Owners) Scan

func (t *Owners) Scan(src any) error

func (Owners) String

func (t Owners) String() string

func (Owners) Value

func (t Owners) Value() (driver.Value, error)

type RemoveOwnerCmd

type RemoveOwnerCmd struct {
	User    *users.User
	Owner   *users.User
	SpaceID uuid.UUID
}

func (RemoveOwnerCmd) Validate

func (t RemoveOwnerCmd) Validate() error

Validate the fields.

type Service

type Service interface {
	Bootstrap(ctx context.Context, user *users.User) error
	Create(ctx context.Context, cmd *CreateCmd) (*Space, error)
	GetAllUserSpaces(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Space, error)
	GetAllSpaces(ctx context.Context, user *users.User, cmd *sqlstorage.PaginateCmd) ([]Space, error)
	GetUserSpace(ctx context.Context, userID, spaceID uuid.UUID) (*Space, error)
	GetByID(ctx context.Context, spaceID uuid.UUID) (*Space, error)
	AddOwner(ctx context.Context, cmd *AddOwnerCmd) (*Space, error)
	RemoveOwner(ctx context.Context, cmd *RemoveOwnerCmd) (*Space, error)
	Delete(ctx context.Context, user *users.User, spaceID uuid.UUID) error
}

func Init

func Init(tools tools.Tools, db sqlstorage.Querier, scheduler scheduler.Service) Service

type Space

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

func (Space) CreatedAt

func (f Space) CreatedAt() time.Time

func (Space) CreatedBy

func (f Space) CreatedBy() uuid.UUID

func (Space) ID

func (f Space) ID() uuid.UUID

func (Space) Name

func (f Space) Name() string

func (Space) Owners

func (f Space) Owners() Owners

Jump to

Keyboard shortcuts

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