Documentation ¶
Overview ¶
Package area provides all the required functions to manage the definition of areas.
Index ¶
- Constants
- func FilterByName(name string) func(db *gorm.DB) *gorm.DB
- func FilterByPath(pathOfParent path.Path) func(db *gorm.DB) *gorm.DB
- func FilterBySpaceID(spaceID uuid.UUID) func(db *gorm.DB) *gorm.DB
- type Area
- type GormAreaRepository
- func (m *GormAreaRepository) CheckExists(ctx context.Context, id uuid.UUID) error
- func (m *GormAreaRepository) Create(ctx context.Context, u *Area) error
- func (m *GormAreaRepository) List(ctx context.Context, spaceID uuid.UUID) ([]Area, error)
- func (m *GormAreaRepository) ListChildren(ctx context.Context, parentArea *Area) ([]Area, error)
- func (m *GormAreaRepository) Load(ctx context.Context, id uuid.UUID) (*Area, error)
- func (m *GormAreaRepository) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Area, error)
- func (m *GormAreaRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]Area, error)
- func (m *GormAreaRepository) Root(ctx context.Context, spaceID uuid.UUID) (*Area, error)
- type Repository
Constants ¶
const APIStringTypeAreas = "areas"
Variables ¶
This section is empty.
Functions ¶
func FilterByName ¶
FilterByName is a gorm filter by 'name'
func FilterByPath ¶
FilterByPath is a gorm filter by 'path' of the parent area for any given area.
Types ¶
type Area ¶
type Area struct { gormsupport.Lifecycle ID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"` // This is the ID PK field SpaceID uuid.UUID `sql:"type:uuid"` Path path.Path Name string Version int }
Area describes a single Area
func (Area) GetETagData ¶
func (m Area) GetETagData() []interface{}
GetETagData returns the field values to use to generate the ETag
func (Area) GetLastModified ¶
GetLastModified returns the last modification time
func (*Area) MakeChildOf ¶
MakeChildOf does all the path magic to make the current area a child of the given parent area.
type GormAreaRepository ¶
type GormAreaRepository struct {
// contains filtered or unexported fields
}
GormAreaRepository is the implementation of the storage interface for Areas.
func (*GormAreaRepository) CheckExists ¶
CheckExists returns nil if the given ID exists otherwise returns an error
func (*GormAreaRepository) Create ¶
func (m *GormAreaRepository) Create(ctx context.Context, u *Area) error
Create creates a new record.
func (*GormAreaRepository) ListChildren ¶
ListChildren fetches all Areas belonging to a parent - list all child areas.
func (*GormAreaRepository) LoadMultiple ¶
Load multiple areas
type Repository ¶
type Repository interface { repository.Exister Create(ctx context.Context, u *Area) error List(ctx context.Context, spaceID uuid.UUID) ([]Area, error) Load(ctx context.Context, id uuid.UUID) (*Area, error) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Area, error) ListChildren(ctx context.Context, parentArea *Area) ([]Area, error) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]Area, error) Root(ctx context.Context, spaceID uuid.UUID) (*Area, error) }
Repository describes interactions with Areas
func NewAreaRepository ¶
func NewAreaRepository(db *gorm.DB) Repository
NewAreaRepository creates a new storage type.