Documentation
¶
Index ¶
- Constants
- Variables
- type Business
- func (b *Business) Count(ctx context.Context, filter QueryFilter) (int, error)
- func (b *Business) Create(ctx context.Context, ns NewStreet) (Street, error)
- func (b *Business) Delete(ctx context.Context, str Street) 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) ([]Street, error)
- func (b *Business) QueryByID(ctx context.Context, streetID uuid.UUID) (Street, error)
- func (b *Business) Update(ctx context.Context, str Street, us UpdateStreet) (Street, error)
- type NewStreet
- type QueryFilter
- type Storer
- type Street
- type UpdateStreet
Constants ¶
View Source
const ( OrderByID = "street_id" OrderByCityID = "city_id" OrderByLine1 = "line_1" OrderByLine2 = "line_2" OrderByPostalCode = "postal_code" )
Set of fields that the results can be ordered by.
Variables ¶
View Source
var ( ErrNotFound = errors.New("street not found") ErrAuthenticationFailure = errors.New("authentication failed") ErrUniqueEntry = errors.New("street entry is not unique") )
Set of error variables for CRUD operations.
View Source
var DefaultOrderBy = order.NewBy(OrderByLine1, 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 street access.
func NewBusiness ¶
NewBusiness constructs a street 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) ([]Street, error)
Query retrieves a list of streets from the system.
type QueryFilter ¶
type QueryFilter struct { ID *uuid.UUID CityID *uuid.UUID Line1 *string Line2 *string PostalCode *string }
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, street Street) error Update(ctx context.Context, street Street) error Delete(ctx context.Context, street Street) error Query(ctx context.Context, filter QueryFilter, orderBy order.By, page page.Page) ([]Street, error) Count(ctx context.Context, filter QueryFilter) (int, error) QueryByID(ctx context.Context, streetID uuid.UUID) (Street, error) }
Storer interface declares the behavior this package needs to persist and retrieve data.
Click to show internal directories.
Click to hide internal directories.