Documentation
¶
Index ¶
- Constants
- Variables
- type AssetType
- type Business
- func (b *Business) Count(ctx context.Context, filter QueryFilter) (int, error)
- func (b *Business) Create(ctx context.Context, nat NewAssetType) (AssetType, error)
- func (b *Business) Delete(ctx context.Context, at AssetType) error
- func (b *Business) NewWithTx(tx sqldb.CommitRollbacker) (*Business, error)
- func (b *Business) Query(ctx context.Context, filter QueryFilter, orderBy order.By, page page.Page) ([]AssetType, error)
- func (b *Business) QueryByID(ctx context.Context, id uuid.UUID) (AssetType, error)
- func (b *Business) Update(ctx context.Context, at AssetType, uat UpdateAssetType) (AssetType, error)
- type NewAssetType
- type QueryFilter
- type Storer
- type UpdateAssetType
Constants ¶
const ( OrderByID = "asset_type_id" OrderByName = "name" OrderByDescription = "description" )
Set of fields that the results can be ordered by.
Variables ¶
var ( ErrNotFound = errors.New("asset type not found") ErrAuthenticationFailure = errors.New("authentication failed") ErrUniqueEntry = errors.New("asset type entry is not unique") )
Set of error variables for CRUD operations.
var DefaultOrderBy = order.NewBy(OrderByName, order.ASC)
DefaultOrderBy represents the default way we sort.
Functions ¶
This section is empty.
Types ¶
type Business ¶
type Business struct {
// contains filtered or unexported fields
}
Business manages the set of APIs for asset type access.
func NewBusiness ¶
NewBusiness constructs a asset type business API for use.
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) ([]AssetType, error)
Query retrieves a list of existing asset types from the system.
type NewAssetType ¶
func TestNewAssetTypes ¶
func TestNewAssetTypes(n int) []NewAssetType
TestNewAssetTypes is a helper method for testing.
type QueryFilter ¶
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, assetType AssetType) error Update(ctx context.Context, assetType AssetType) error Delete(ctx context.Context, assetType AssetType) error Query(ctx context.Context, filter QueryFilter, orderBy order.By, page page.Page) ([]AssetType, error) Count(ctx context.Context, filter QueryFilter) (int, error) QueryByID(ctx context.Context, assetTypeID uuid.UUID) (AssetType, error) }
Storer interface declares the behavior this package needs to persist and retrieve data.