label

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const APIStringTypeLabels = "labels"

APIStringTypeLabels helps to avoid string literal

View Source
const LabelTableName = "labels"

LabelTableName constant that holds table name of Labels

Variables

This section is empty.

Functions

This section is empty.

Types

type GormLabelRepository

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

GormLabelRepository is the implementation of the storage interface for Labels.

func (*GormLabelRepository) Create

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

Create a new label

func (*GormLabelRepository) IsValid

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

IsValid returns true if the identity exists

func (*GormLabelRepository) List

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

List all labels in a space

func (*GormLabelRepository) Load

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

Load label in a space

func (*GormLabelRepository) Save

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

Save update the given label

type Label

type Label 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"`
	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

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

GetETagData returns the field values to use to generate the ETag

func (Label) GetLastModified

func (m Label) GetLastModified() time.Time

GetLastModified returns the last modification time

func (Label) TableName

func (m Label) TableName() string

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

type Repository

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

func NewLabelRepository(db *gorm.DB) Repository

NewLabelRepository creates a new storage type.

Jump to

Keyboard shortcuts

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