Documentation
¶
Index ¶
- Variables
- func MakeAddFollowerEndpoint(s Service) endpoint.Endpoint
- func MakeDeleteFollowerEndpoint(s Service) endpoint.Endpoint
- func MakeListEndpoint(s Service) endpoint.Endpoint
- func MakeListFollowersEndpoint(s Service) endpoint.Endpoint
- func MakeListFollowingsEndpoint(s Service) endpoint.Endpoint
- func MakeReadEndpoint(s Service) endpoint.Endpoint
- func MakeUpsertEndpoint(s Service) endpoint.Endpoint
- type Endpoints
- type Filter
- type HTTPHandlerParams
- type HTTPHandlerSet
- type ListRequest
- type ListResponse
- type Publisher
- type PublisherImpl
- type Repository
- type RepositoryImpl
- func (r RepositoryImpl) AddFollower(profileID, followerID uuid.UUID) error
- func (r RepositoryImpl) DeleteFollower(profileID, followerID uuid.UUID) error
- func (r RepositoryImpl) FindAllWithFilter(offset int64, limit int, f Filter) ([]domain.Profile, error)
- func (r RepositoryImpl) FindByID(id uuid.UUID) (profile *domain.Profile, err error)
- func (r RepositoryImpl) FindByIDs(ids []uuid.UUID) (res map[uuid.UUID]domain.Profile, err error)
- func (r RepositoryImpl) FindFollowers(id uuid.UUID, offset int64, limit int) ([]domain.Profile, error)
- func (r RepositoryImpl) FindFollowings(id uuid.UUID) ([]domain.Profile, error)
- func (r RepositoryImpl) Insert(profile *domain.Profile) error
- func (r RepositoryImpl) Update(profile *domain.Profile) error
- type Service
Constants ¶
This section is empty.
Variables ¶
var WireSet = wire.NewSet( NewService, NewHTTPHandlerSet, MakeServerEndpoints, NewPublisher, wire.Bind(new(Repository), new(*RepositoryImpl)), wire.Bind(new(Publisher), new(*PublisherImpl)), NewProfileRepository, wire.Struct(new(HTTPHandlerParams), "*"), )
Functions ¶
func MakeAddFollowerEndpoint ¶
MakeAddFollowerEndpoint returns an endpoint that invokes AddFollower on the service.
func MakeDeleteFollowerEndpoint ¶
MakeDeleteFollowerEndpoint returns an endpoint that invokes AddFollower on the service.
func MakeListEndpoint ¶
MakeListEndpoint returns an endpoint that invokes List on the service.
func MakeListFollowersEndpoint ¶
MakeListFollowersEndpoint returns an endpoint that invokes ListFollowers on the service.
func MakeListFollowingsEndpoint ¶
MakeListFollowingsEndpoint returns an endpoint that invokes ListFollowings on the service.
func MakeReadEndpoint ¶
MakeReadEndpoint returns an endpoint that invokes Read on the service.
func MakeUpsertEndpoint ¶
MakeUpsertEndpoint returns an endpoint via the passed service.
Types ¶
type Endpoints ¶
type Endpoints struct { ReadEndpoint endpoint.Endpoint ListEndpoint endpoint.Endpoint UpsertEndpoint endpoint.Endpoint AddFollowerEndpoint endpoint.Endpoint DeleteFollowerEndpoint endpoint.Endpoint ListFollowingsEndpoint endpoint.Endpoint ListFollowersEndpoint endpoint.Endpoint }
func MakeServerEndpoints ¶
func MakeServerEndpoints(s Service, params auth.EndpointParams) Endpoints
MakeServerEndpoints returns an Endpoints struct where each endpoint invokes the corresponding method on the provided service. Useful in a profilesvc server.
type HTTPHandlerParams ¶
HTTPHandlerParams provides params for handlers service options.
type HTTPHandlerSet ¶
type HTTPHandlerSet struct { UpsertProfileHandler http.Handler ReadProfileHandler http.Handler ListProfileHandler http.Handler ListFollowingsHandler http.Handler AddFollowerHandler http.Handler DeleteFollowerHandler http.Handler ListFollowersHandler http.Handler }
HTTPHandlerSet contains all service http handlers to register it in mux.router later.
func NewHTTPHandlerSet ¶
func NewHTTPHandlerSet(endpoints Endpoints, params HTTPHandlerParams) HTTPHandlerSet
NewHTTPHandlerSet returns a http handler set for registration in the mux.Router later
func (*HTTPHandlerSet) Register ¶
func (h *HTTPHandlerSet) Register(m *mux.Router)
Register add handlers to mux.Router with theirs paths.
type ListRequest ¶
type ListRequest struct { FirstName string `json:"-"` LastName string `json:"-"` Limit int `json:"-"` Offset int64 `json:"-"` IDs []uuid.UUID `json:"-"` }
ListRequest collects the request parameters for the List method.
type ListResponse ¶
type ListResponse struct { Profiles []domain.Profile `json:"data"` Err error `json:"err,omitempty"` }
ListResponse collects the response parameters for the List method.
type PublisherImpl ¶
type PublisherImpl struct { ProfileFollowingCreatedEventEndpoint endpoint.Endpoint ProfileFollowingDeletedEventEndpoint endpoint.Endpoint }
func NewPublisher ¶
func (PublisherImpl) PublishProfileFollowingCreatedEvent ¶
func (publisher PublisherImpl) PublishProfileFollowingCreatedEvent(ctx context.Context, profileID, followerID uuid.UUID) error
func (PublisherImpl) PublishProfileFollowingDeletedEvent ¶
func (publisher PublisherImpl) PublishProfileFollowingDeletedEvent(ctx context.Context, profileID, followerID uuid.UUID) error
type Repository ¶
type Repository interface { FindByID(id uuid.UUID) (*domain.Profile, error) AddFollower(profileID, followerID uuid.UUID) error DeleteFollower(profileID, followerID uuid.UUID) error Insert(profile *domain.Profile) error Update(profile *domain.Profile) error FindAllWithFilter(offset int64, limit int, f Filter) ([]domain.Profile, error) FindFollowers(id uuid.UUID, offset int64, limit int) ([]domain.Profile, error) FindFollowings(id uuid.UUID) ([]domain.Profile, error) FindByIDs(ids []uuid.UUID) (map[uuid.UUID]domain.Profile, error) }
type RepositoryImpl ¶
type RepositoryImpl struct {
// contains filtered or unexported fields
}
repository represent profile db profile Repository.
func NewProfileRepository ¶
func NewProfileRepository( masterConn database.QueryerExecer, slaveConn database.Queryer, ) *RepositoryImpl
NewProfileRepository is constructor.
func (RepositoryImpl) AddFollower ¶
func (r RepositoryImpl) AddFollower(profileID, followerID uuid.UUID) error
func (RepositoryImpl) DeleteFollower ¶
func (r RepositoryImpl) DeleteFollower(profileID, followerID uuid.UUID) error
func (RepositoryImpl) FindAllWithFilter ¶
func (r RepositoryImpl) FindAllWithFilter(offset int64, limit int, f Filter) ([]domain.Profile, error)
FindAllWithFilter finds profiles by Filter.
func (RepositoryImpl) FindByID ¶
func (r RepositoryImpl) FindByID(id uuid.UUID) (profile *domain.Profile, err error)
FindByID finds profile by id.
func (RepositoryImpl) FindByIDs ¶
func (r RepositoryImpl) FindByIDs(ids []uuid.UUID) (res map[uuid.UUID]domain.Profile, err error)
func (RepositoryImpl) FindFollowers ¶
func (RepositoryImpl) FindFollowings ¶
func (r RepositoryImpl) FindFollowings(id uuid.UUID) ([]domain.Profile, error)
type Service ¶
type Service interface { List(ctx context.Context, limit int, offset int64, filter Filter) ([]domain.Profile, error) Upsert(ctx context.Context, id uuid.UUID, profile domain.Profile) (result *domain.Profile, err error) Read(ctx context.Context, id uuid.UUID) (result *domain.Profile, err error) AddFollower(ctx context.Context, id, followerID uuid.UUID) error RemoveFollower(ctx context.Context, id, followerID uuid.UUID) error ListFollowings(ctx context.Context, id uuid.UUID) ([]domain.Profile, error) ListFollowers(ctx context.Context, id uuid.UUID) ([]domain.Profile, error) }
func NewService ¶
func NewService( repository Repository, uuidGenerator uuid.Generator, publisher Publisher, ) Service