assettagbus

package
v0.0.0-...-16ef530 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderByID      = "asset_tag_id"
	OrderByAssetID = "asset_id"
	OrderByTagID   = "tag_id"
)

Variables

View Source
var (
	ErrNotFound              = errors.New("asset tag not found")
	ErrAuthenticationFailure = errors.New("authentication failure")
	ErrUniqueEntry           = errors.New("asset tag entry is not unique")
)

Set of error variables for CRUD operations.

View Source
var DefaultOrderBy = order.NewBy(OrderByID, order.ASC)

Functions

This section is empty.

Types

type AssetTag

type AssetTag struct {
	ID      uuid.UUID
	AssetID uuid.UUID
	TagID   uuid.UUID
}

func TestSeedAssetTag

func TestSeedAssetTag(ctx context.Context, n int, assetIDs, tagIDs []uuid.UUID, api *Business) ([]AssetTag, error)

type Business

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

Business manages the set of APIs for tag access.

func NewBusiness

func NewBusiness(log *logger.Logger, delegate *delegate.Delegate, storer Storer) *Business

NewBusiness constructs an asset tag business API for use.

func (*Business) Count

func (b *Business) Count(ctx context.Context, filter QueryFilter) (int, error)

Count returns the total number of tags.

func (*Business) Create

func (b *Business) Create(ctx context.Context, nat NewAssetTag) (AssetTag, error)

Create adds a new asset tag in the system.

func (*Business) Delete

func (b *Business) Delete(ctx context.Context, at AssetTag) error

Delete removes an asset tag from the system.

func (*Business) NewWithTx

func (b *Business) NewWithTx(tx sqldb.CommitRollbacker) (*Business, error)

NewWithTx constructs a new business value that will use the specified transaction in any store related calls.

func (*Business) Query

func (b *Business) Query(ctx context.Context, filter QueryFilter, orderBy order.By, page page.Page) ([]AssetTag, error)

Query retrieves a list of existing asset tags from the system.

func (*Business) QueryByID

func (b *Business) QueryByID(ctx context.Context, id uuid.UUID) (AssetTag, error)

QueryByID finds the tag by the specified ID.

func (*Business) Update

func (b *Business) Update(ctx context.Context, at AssetTag, uat UpdateAssetTag) (AssetTag, error)

Update updates an existing asset tag.

type NewAssetTag

type NewAssetTag struct {
	AssetID uuid.UUID
	TagID   uuid.UUID
}

func TestNewAssetTag

func TestNewAssetTag(n int, assetIDs, tagIDs []uuid.UUID) []NewAssetTag

type QueryFilter

type QueryFilter struct {
	ID      *uuid.UUID
	AssetID *uuid.UUID
	TagID   *uuid.UUID
}

QueryFilter holds the available fields a query can be filtered on. We are using pointer semantics because the With API mutates the value.

type Storer

type Storer interface {
	NewWithTx(tx sqldb.CommitRollbacker) (Storer, error)
	Create(ctx context.Context, tag AssetTag) error
	Update(ctx context.Context, tag AssetTag) error
	Delete(ctx context.Context, tag AssetTag) error
	Query(ctx context.Context, filter QueryFilter, orderBy order.By, page page.Page) ([]AssetTag, error)
	Count(ctx context.Context, filter QueryFilter) (int, error)
	QueryByID(ctx context.Context, tagID uuid.UUID) (AssetTag, error)
}

Storer interface declares the behavior this package needs to persist and retrieve data.

type UpdateAssetTag

type UpdateAssetTag struct {
	AssetID *uuid.UUID
	TagID   *uuid.UUID
}

Directories

Path Synopsis
store

Jump to

Keyboard shortcuts

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