Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
Types ¶
type CreateActivityRequest ¶
type CreateActivityRequest struct {
Kind string `json:"kind" validate:"required,alpha"`
Username string `json:"username" validate:"required,alpha"`
Target string `json:"target" validate:"required,alpha"`
}
CreateActivityRequest represents a user creation request.
type Repository ¶
type Repository interface {
// Get returns the activity with the specified activity ID.
Get(ctx context.Context, id string, fields []string) (entity.Activity, error)
// Count returns the number of activities.
Count(ctx context.Context) (int, error)
// Query returns the list of activities with the given offset and limit.
Query(ctx context.Context, offset, limit int) ([]interface{}, error)
// Create saves a new activity in the storage.
Create(ctx context.Context, activity entity.Activity) error
// Update updates the whole activity with given ID in the storage.
Update(ctx context.Context, key string, activity entity.Activity) error
// Patch patches a sub entry in the activity with given ID in the storage.
Patch(ctx context.Context, key, path string, val interface{}) error
// Delete removes the activity with given ID from the storage.
Delete(ctx context.Context, id string) error
}
Repository encapsulates the logic to access users from the data source.
func NewRepository ¶
func NewRepository(db *dbcontext.DB, logger log.Logger) Repository
NewRepository creates a new activity repository.
type Service ¶
type Service interface {
Get(ctx context.Context, id string, fields []string) (Activity, error)
Query(ctx context.Context, offset, limit int) ([]interface{}, error)
Count(ctx context.Context) (int, error)
Create(ctx context.Context, input CreateActivityRequest) (Activity, error)
Update(ctx context.Context, id string, input UpdateActivityRequest) (Activity, error)
Delete(ctx context.Context, id string) (Activity, error)
}
Service encapsulates usecase logic for users.
func NewService ¶
func NewService(repo Repository, logger log.Logger) Service
NewService creates a new user service.
type UpdateActivityRequest ¶
type UpdateActivityRequest struct {
Target string `json:"target" validate:"required,alpha"`
}
UpdateActivityRequest represents a user update request.
Click to show internal directories.
Click to hide internal directories.