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

package space

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

Package space provides all the required functions to manage the definition of spaces.

Index

Package Files

doc.go space.go

Variables

var (
    // SystemSpace used to be a concept space that existed to house certain work
    // item types that would then be shared among all spaces. This concept was
    // deprecated with the advent of space templates.
    // TODO(kwk): Remove system space entirely.
    SystemSpace = uuid.FromStringOrNil("2e0698d8-753e-4cef-bb7c-f027634824a2")
    SpaceType   = "spaces"
)

type GormRepository Uses

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

GormRepository implements SpaceRepository using gorm

func NewRepository Uses

func NewRepository(db *gorm.DB) *GormRepository

NewRepository creates a new space repo

func (*GormRepository) CheckExists Uses

func (r *GormRepository) CheckExists(ctx context.Context, id uuid.UUID) error

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

func (*GormRepository) Create Uses

func (r *GormRepository) Create(ctx context.Context, space *Space) (*Space, error)

Create creates a new Space in the db returns BadParameterError or InternalError

func (*GormRepository) Delete Uses

func (r *GormRepository) Delete(ctx context.Context, ID uuid.UUID) error

Delete deletes the space with the given id returns NotFoundError or InternalError

func (*GormRepository) List Uses

func (r *GormRepository) List(ctx context.Context, start *int, limit *int) ([]Space, int, error)

List returns work item selected by the given criteria.Expression, starting with start (zero-based) and returning at most limit items

func (*GormRepository) Load Uses

func (r *GormRepository) Load(ctx context.Context, ID uuid.UUID) (*Space, error)

Load returns the space for the given id returns NotFoundError or InternalError

func (*GormRepository) LoadByOwner Uses

func (r *GormRepository) LoadByOwner(ctx context.Context, userID *uuid.UUID, start *int, limit *int) ([]Space, int, error)

func (*GormRepository) LoadByOwnerAndName Uses

func (r *GormRepository) LoadByOwnerAndName(ctx context.Context, userID *uuid.UUID, spaceName *string) (*Space, error)

func (*GormRepository) LoadMany Uses

func (r *GormRepository) LoadMany(ctx context.Context, IDs []uuid.UUID) ([]Space, error)

LoadMany returns the spaces for the given IDs returns NotFoundError or InternalError

func (*GormRepository) Save Uses

func (r *GormRepository) Save(ctx context.Context, p *Space) (*Space, error)

Save updates the given space in the db. Version must be the same as the one in the stored version returns NotFoundError, BadParameterError, VersionConflictError or InternalError

func (*GormRepository) Search Uses

func (r *GormRepository) Search(ctx context.Context, q *string, start *int, limit *int) ([]Space, int, error)

type Repository Uses

type Repository interface {
    repository.Exister
    Create(ctx context.Context, space *Space) (*Space, error)
    Save(ctx context.Context, space *Space) (*Space, error)
    Load(ctx context.Context, ID uuid.UUID) (*Space, error)
    LoadMany(ctx context.Context, IDs []uuid.UUID) ([]Space, error)
    Delete(ctx context.Context, ID uuid.UUID) error
    LoadByOwner(ctx context.Context, userID *uuid.UUID, start *int, length *int) ([]Space, int, error)
    LoadByOwnerAndName(ctx context.Context, userID *uuid.UUID, spaceName *string) (*Space, error)
    List(ctx context.Context, start *int, length *int) ([]Space, int, error)
    Search(ctx context.Context, q *string, start *int, length *int) ([]Space, int, error)
}

Repository encapsulate storage & retrieval of spaces

type Space Uses

type Space struct {
    gormsupport.Lifecycle
    ID              uuid.UUID
    Version         int
    Name            string
    Description     string
    OwnerID         uuid.UUID `sql:"type:uuid"` // Belongs To Identity
    SpaceTemplateID uuid.UUID `sql:"type:uuid"`
}

Space represents a Space on the domain and db layer

func (Space) Equal Uses

func (p Space) Equal(u convert.Equaler) bool

Equal returns true if two Space objects are equal; otherwise false is returned.

func (Space) EqualValue Uses

func (p Space) EqualValue(u convert.Equaler) bool

EqualValue implements convert.Equaler

func (Space) GetETagData Uses

func (p Space) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (Space) GetLastModified Uses

func (p Space) GetLastModified() time.Time

GetLastModified returns the last modification time

func (Space) TableName Uses

func (p Space) TableName() string

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

Directories

PathSynopsis
authzPackage authz contains the code that authorizes space operations

Package space imports 16 packages (graph) and is imported by 46 packages. Updated 2018-10-22. Refresh now. Tools for package owners.