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

package label

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


Package Files



const APIStringTypeLabels = "labels"

APIStringTypeLabels helps to avoid string literal

const LabelTableName = "labels"

LabelTableName constant that holds table name of Labels

type GormLabelRepository Uses

type GormLabelRepository struct {
    // contains filtered or unexported fields

GormLabelRepository is the implementation of the storage interface for Labels.

func (*GormLabelRepository) Create Uses

func (m *GormLabelRepository) Create(ctx context.Context, u *Label) error

Create a new label

func (*GormLabelRepository) IsValid Uses

func (m *GormLabelRepository) IsValid(ctx context.Context, id uuid.UUID) bool

IsValid returns true if the identity exists

func (*GormLabelRepository) List Uses

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

List all labels in a space

func (*GormLabelRepository) Load Uses

func (m *GormLabelRepository) Load(ctx context.Context, ID uuid.UUID) (*Label, error)

Load label in a space

func (*GormLabelRepository) Save Uses

func (m *GormLabelRepository) Save(ctx context.Context, l Label) (*Label, error)

Save update the given label

type Label Uses

type Label 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"`
    Name            string
    TextColor       string `sql:"DEFAULT:#000000"`
    BackgroundColor string `sql:"DEFAULT:#FFFFFF"`
    BorderColor     string `sql:"DEFAULT:#000000"`
    Version         int

Label describes a single Label

func (Label) GetETagData Uses

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

GetETagData returns the field values to use to generate the ETag

func (Label) GetLastModified Uses

func (m Label) GetLastModified() time.Time

GetLastModified returns the last modification time

func (Label) TableName Uses

func (m Label) TableName() string

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

type Repository Uses

type Repository interface {
    Create(ctx context.Context, u *Label) error
    List(ctx context.Context, spaceID uuid.UUID) ([]Label, error)
    IsValid(ctx context.Context, id uuid.UUID) bool
    Load(ctx context.Context, labelID uuid.UUID) (*Label, error)
    Save(ctx context.Context, lbl Label) (*Label, error)

Repository describes interactions with Labels

func NewLabelRepository Uses

func NewLabelRepository(db *gorm.DB) Repository

NewLabelRepository creates a new storage type.

Package label imports 11 packages (graph) and is imported by 25 packages. Updated 2018-07-25. Refresh now. Tools for package owners.