Documentation ¶
Overview ¶
Package usersummary provides an example of a core business API that is based on a view.
Index ¶
Constants ¶
View Source
const ( OrderByUserID = "userid" OrderByUserName = "username" )
Set of fields that the results can be ordered by. These are the names that should be used by the application layer.
Variables ¶
View Source
var DefaultOrderBy = order.NewBy(OrderByUserID, order.ASC)
DefaultOrderBy represents the default way we sort.
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core manages the set of API's for user summaries.
type QueryFilter ¶
type QueryFilter struct { UserID *uuid.UUID `validate:"omitempty"` UserName *string `validate:"omitempty,min=3"` }
QueryFilter holds the available fields a query can be filtered on.
func (*QueryFilter) Validate ¶
func (qf *QueryFilter) Validate() error
func (*QueryFilter) WithUserID ¶
func (qf *QueryFilter) WithUserID(userID uuid.UUID)
WithUserID sets the UserID field of the QueryFilter value.
func (*QueryFilter) WithUserName ¶
func (qf *QueryFilter) WithUserName(userName string)
WithUserName sets the UserName field of the QueryFilter value.
type Storer ¶
type Storer interface { Query(ctx context.Context, filter QueryFilter, orderBy order.By, pageNumber int, rowsPerPage int) ([]Summary, error) Count(ctx context.Context, filter QueryFilter) (int, error) }
Storer interface declares the behavior this package needs to persist and retrieve data.
Click to show internal directories.
Click to hide internal directories.