Documentation
¶
Index ¶
- Constants
- Variables
- type AssetCondition
- type Business
- func (b *Business) Count(ctx context.Context, filter QueryFilter) (int, error)
- func (b *Business) Create(ctx context.Context, nat NewAssetCondition) (AssetCondition, error)
- func (b *Business) Delete(ctx context.Context, at AssetCondition) 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) ([]AssetCondition, error)
- func (b *Business) QueryByID(ctx context.Context, id uuid.UUID) (AssetCondition, error)
- func (b *Business) Update(ctx context.Context, at AssetCondition, uat UpdateAssetCondition) (AssetCondition, error)
- type NewAssetCondition
- type QueryFilter
- type Storer
- type UpdateAssetCondition
Constants ¶
const ( OrderByID = "asset_condition_id" OrderByName = "name" OrderByDescription = "description" )
Set of fields that the results can be ordered by.
Variables ¶
var ( ErrNotFound = errors.New("asset condition not found") ErrAuthenticationFailure = errors.New("authentication failure") ErrUniqueEntry = errors.New("asset condition 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 AssetCondition ¶
AssetCondition represents information about an individual asset condition.
func TestSeedAssetConditions ¶
TestSeedAssetConditions is a helper method for testing.
type Business ¶
type Business struct {
// contains filtered or unexported fields
}
Business manages the set of APIs for asset condition access.
func NewBusiness ¶
NewBusiness constructs a asset condition business API for use.
func (*Business) Create ¶
func (b *Business) Create(ctx context.Context, nat NewAssetCondition) (AssetCondition, error)
Create adds a new asset condition to the system.
func (*Business) Delete ¶
func (b *Business) Delete(ctx context.Context, at AssetCondition) error
Delete removes an asset condition 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) ([]AssetCondition, error)
Query retrieves a list of existing asset conditions from the system.
func (*Business) Update ¶
func (b *Business) Update(ctx context.Context, at AssetCondition, uat UpdateAssetCondition) (AssetCondition, error)
Update updates an existing asset condition.
type NewAssetCondition ¶
func TestNewAssetConditions ¶
func TestNewAssetConditions(n int) []NewAssetCondition
TestNewAssetConditions 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, assetCondition AssetCondition) error Update(ctx context.Context, assetCondition AssetCondition) error Delete(ctx context.Context, assetCondition AssetCondition) error Query(ctx context.Context, filter QueryFilter, orderBy order.By, page page.Page) ([]AssetCondition, error) Count(ctx context.Context, filter QueryFilter) (int, error) QueryByID(ctx context.Context, assetConditionID uuid.UUID) (AssetCondition, error) }
Storer interface declares the behavior this package needs to persist and retrieve data.