fabric8-wit: github.com/fabric8-services/fabric8-wit/area Index | Files

package area

import "github.com/fabric8-services/fabric8-wit/area"

Package area provides all the required functions to manage the definition of areas.


Package Files

area.go doc.go


const APIStringTypeAreas = "areas"

func FilterByName Uses

func FilterByName(name string) func(db *gorm.DB) *gorm.DB

FilterByName is a gorm filter by 'name'

func FilterBySpaceID Uses

func FilterBySpaceID(spaceID uuid.UUID) func(db *gorm.DB) *gorm.DB

FilterBySpaceID is a gorm filter for a Belongs To relationship.

type Area Uses

type Area struct {
    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 Uses

func (m Area) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (Area) GetLastModified Uses

func (m Area) GetLastModified() time.Time

GetLastModified returns the last modification time

func (*Area) MakeChildOf Uses

func (m *Area) MakeChildOf(parent Area)

MakeChildOf does all the path magic to make the current area a child of the given parent area.

func (Area) TableName Uses

func (m Area) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type GormAreaRepository Uses

type GormAreaRepository struct {
    // contains filtered or unexported fields

GormAreaRepository is the implementation of the storage interface for Areas.

func (*GormAreaRepository) CheckExists Uses

func (m *GormAreaRepository) CheckExists(ctx context.Context, id uuid.UUID) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormAreaRepository) Create Uses

func (m *GormAreaRepository) Create(ctx context.Context, u *Area) error

Create creates a new record.

func (*GormAreaRepository) List Uses

func (m *GormAreaRepository) List(ctx context.Context, spaceID uuid.UUID) ([]Area, error)

List all Areas related to a single item

func (*GormAreaRepository) ListChildren Uses

func (m *GormAreaRepository) ListChildren(ctx context.Context, parentArea *Area) ([]Area, error)

ListChildren fetches all Areas belonging to a parent - list all child areas.

func (*GormAreaRepository) Load Uses

func (m *GormAreaRepository) Load(ctx context.Context, id uuid.UUID) (*Area, error)

Load a single Area regardless of parent

func (*GormAreaRepository) LoadMultiple Uses

func (m *GormAreaRepository) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Area, error)

Load multiple areas

func (*GormAreaRepository) Query Uses

func (m *GormAreaRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]Area, error)

Query exposes an open ended Query model for Area

func (*GormAreaRepository) Root Uses

func (m *GormAreaRepository) Root(ctx context.Context, spaceID uuid.UUID) (*Area, error)

Root fetches the Root Areas inside a space.

type Repository Uses

type Repository interface {
    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 Uses

func NewAreaRepository(db *gorm.DB) Repository

NewAreaRepository creates a new storage type.

Package area imports 13 packages (graph) and is imported by 29 packages. Updated 2018-10-14. Refresh now. Tools for package owners.