Documentation
¶
Index ¶
- Constants
- Variables
- type Business
- func (b *Business) Count(ctx context.Context, filter QueryFilter) (int, 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) ([]Region, error)
- func (b *Business) QueryByID(ctx context.Context, regionID uuid.UUID) (Region, error)
- type QueryFilter
- type Region
- type Storer
Constants ¶
const ( OrderByID = "region_id" OrderByName = "name" OrderByCode = "code" OrderByCountryID = "country_id" )
Set of fields that the results can be ordered by.
Variables ¶
var DefaultOrderBy = order.NewBy(OrderByName, order.ASC)
DefaultOrderBy represents the default way we sort. Usually we order by id but in the case of countries, they almost always should be by their country.
var (
ErrNotFound = fmt.Errorf("region not found")
)
Set error variables.
Functions ¶
This section is empty.
Types ¶
type Business ¶
type Business struct {
// contains filtered or unexported fields
}
Business manages the set of APIs for region access.
func NewBusiness ¶
NewBusiness constructs a country 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.
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 Region ¶
NOTE: Regions are special. They are controlled solely in the database and therefore should have ONLY retrive actions available. No create, update, or delete actions are allowed. We want only the highest level admins to have any way to touch this because it denotes areas we support.
type Storer ¶
type Storer interface { NewWithTx(tx sqldb.CommitRollbacker) (Storer, error) Count(ctx context.Context, filter QueryFilter) (int, error) Query(ctx context.Context, filter QueryFilter, orderBy order.By, page page.Page) ([]Region, error) QueryByID(ctx context.Context, regionID uuid.UUID) (Region, error) }
Storer defines the database interaction methods.