Documentation ¶
Index ¶
- Variables
- func MakeAuthenticateEndpoint(s Service) endpoint.Endpoint
- func MakeCreateAccountEndpoint(s Service) endpoint.Endpoint
- func MakeListEndpoint(s Service) endpoint.Endpoint
- func MakeReadEndpoint(s Service) endpoint.Endpoint
- type AccountDTO
- type AccountRepository
- type AccountRepositoryImpl
- func (r AccountRepositoryImpl) Exists(login string) (bool, error)
- func (r AccountRepositoryImpl) FindAllWithFilter(offset int64, limit int, f filter) ([]domain.Account, error)
- func (r AccountRepositoryImpl) FindByID(id uuid.UUID) (account *domain.Account, err error)
- func (r AccountRepositoryImpl) FindByLogin(login string) (account *domain.Account, err error)
- func (r AccountRepositoryImpl) Insert(account *domain.Account) error
- func (r AccountRepositoryImpl) Update(account *domain.Account) error
- type CreateDTO
- type Endpoints
- type HTTPHandlerParams
- type HTTPHandlerSet
- type LoginDTO
- type Service
Constants ¶
This section is empty.
Variables ¶
var WireSet = wire.NewSet( NewService, NewHTTPHandlerSet, MakeServerEndpoints, wire.Bind(new(AccountRepository), new(*AccountRepositoryImpl)), NewAccountRepository, wire.Struct(new(HTTPHandlerParams), "*"), )
Functions ¶
func MakeAuthenticateEndpoint ¶
MakeAuthenticateEndpoint returns an endpoint via the passed service.
func MakeCreateAccountEndpoint ¶
MakeCreateAccountEndpoint returns an endpoint via the passed service.
func MakeListEndpoint ¶
MakeListEndpoint returns an endpoint that invokes List on the service.
func MakeReadEndpoint ¶
MakeReadEndpoint returns an endpoint that invokes Read on the service.
Types ¶
type AccountDTO ¶
type AccountDTO struct { ID uuid.UUID `json:"id"` Login string `json:"login"` }
type AccountRepository ¶
type AccountRepository interface { Exists(login string) (bool, error) FindByLogin(login string) (*domain.Account, error) FindByID(id uuid.UUID) (*domain.Account, error) Insert(account *domain.Account) error Update(account *domain.Account) error FindAllWithFilter(offset int64, limit int, f filter) ([]domain.Account, error) }
type AccountRepositoryImpl ¶
type AccountRepositoryImpl struct {
// contains filtered or unexported fields
}
repository represent account db account Repository.
func NewAccountRepository ¶
func NewAccountRepository(db database.QueryerExecer) *AccountRepositoryImpl
NewAccountRepository is constructor.
func (AccountRepositoryImpl) Exists ¶
func (r AccountRepositoryImpl) Exists(login string) (bool, error)
Exists checks existing account.
func (AccountRepositoryImpl) FindAllWithFilter ¶
func (r AccountRepositoryImpl) FindAllWithFilter(offset int64, limit int, f filter) ([]domain.Account, error)
FindAllWithFilter finds accounts by filter.
func (AccountRepositoryImpl) FindByID ¶
func (r AccountRepositoryImpl) FindByID(id uuid.UUID) (account *domain.Account, err error)
FindByID finds account by id.
func (AccountRepositoryImpl) FindByLogin ¶
func (r AccountRepositoryImpl) FindByLogin(login string) (account *domain.Account, err error)
FindByLogin finds account by login.
type Endpoints ¶
type Endpoints struct { CreateAccountEndpoint endpoint.Endpoint AuthenticateEndpoint endpoint.Endpoint ReadEndpoint endpoint.Endpoint ListEndpoint 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 { CreateAccountHandler http.Handler ReadAccountHandler http.Handler ListAccountHandler http.Handler AuthenticateAccountHandler 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 Service ¶
type Service interface { List(ctx context.Context, limit int, offset int64, filter filter) ([]domain.Account, error) Create(ctx context.Context, dto CreateDTO) (result *domain.Account, err error) Read(ctx context.Context, id uuid.UUID) (result *domain.Account, err error) Authenticate(ctx context.Context, dto LoginDTO) (token string, err error) }
func NewService ¶
func NewService( tokenCreator token.Creator, repository AccountRepository, hasher passwordhash.PasswordHasher, uuidGenerator uuid.Generator, ) Service