star

package
v0.10.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

type DuplicateRecordError struct {
	UserID  string
	AssetID string
}

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

type InvalidError struct {
	UserID  string
	AssetID string
}

func (InvalidError) Error

func (e InvalidError) Error() string

type NotFoundError

type NotFoundError struct {
	AssetID string
	UserID  string
}

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 (s *Service) GetStargazers(ctx context.Context, flt Filter, assetID string) ([]user.User, error)

func (*Service) GetStarredAssetByUserID

func (s *Service) GetStarredAssetByUserID(ctx context.Context, userID, assetID string) (asset.Asset, error)

func (*Service) GetStarredAssetsByUserID

func (s *Service) GetStarredAssetsByUserID(ctx context.Context, flt Filter, userID string) ([]asset.Asset, error)

func (*Service) Stars

func (s *Service) Stars(ctx context.Context, userID, assetID string) (string, error)

func (*Service) Unstars

func (s *Service) Unstars(ctx context.Context, userID, assetID string) error

type UserNotFoundError

type UserNotFoundError struct {
	UserID string
}

func (UserNotFoundError) Error

func (e UserNotFoundError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL