Documentation ¶
Index ¶
- Constants
- Variables
- type DuplicateRecordError
- type Filter
- type InvalidError
- type NotFoundError
- type Repository
- type Service
- func (s *Service) GetStargazers(ctx context.Context, flt Filter, assetID string) ([]user.User, error)
- func (s *Service) GetStarredAssetByUserID(ctx context.Context, userID, assetID string) (asset.Asset, error)
- func (s *Service) GetStarredAssetsByUserID(ctx context.Context, flt Filter, userID string) ([]asset.Asset, error)
- func (s *Service) Stars(ctx context.Context, userID, assetID string) (string, error)
- func (s *Service) Unstars(ctx context.Context, userID, assetID string) error
- type UserNotFoundError
Constants ¶
View Source
const ( SortKeyCreated = "created" SortKeyUpdated = "updated" SortDirectionKeyAscending = "asc" SortDirectionKeyDescending = "desc" )
Variables ¶
View Source
var ( ErrEmptyUserID = errors.New("star is not related to any user") ErrEmptyAssetID = errors.New("star is not related to any asset") )
Functions ¶
This section is empty.
Types ¶
type DuplicateRecordError ¶
func (DuplicateRecordError) Error ¶
func (e DuplicateRecordError) Error() string
type Filter ¶
type Filter struct { // Number of relevant results to return Size int // Offset is a data offset in the table rows Offset int // Parameter to sort by `CreatedAt` vs `UpdatedAt` Sort string // SortDirection of sort, ascending/descending SortDirection string }
Filter is a config of star domain
type InvalidError ¶
func (InvalidError) Error ¶
func (e InvalidError) Error() string
type NotFoundError ¶
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type Repository ¶
type Repository interface { Create(ctx context.Context, userID, assetID string) (string, error) GetStargazers(ctx context.Context, flt Filter, assetID string) ([]user.User, error) GetAllAssetsByUserID(ctx context.Context, flt Filter, userID string) ([]asset.Asset, error) GetAssetByUserID(ctx context.Context, userID, assetID string) (asset.Asset, error) Delete(ctx context.Context, userID, assetID string) error }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(starRepository Repository) *Service
func (*Service) GetStargazers ¶
func (*Service) GetStarredAssetByUserID ¶
func (*Service) GetStarredAssetsByUserID ¶
type UserNotFoundError ¶
type UserNotFoundError struct {
UserID string
}
func (UserNotFoundError) Error ¶
func (e UserNotFoundError) Error() string
Click to show internal directories.
Click to hide internal directories.