Documentation ¶
Index ¶
- type FilterOption
- type Option
- type Service
- func (s *Service) AddOrgs(orgs map[string]domain.OrganizationConfig) error
- func (s *Service) Configs(ctx context.Context) (cfgs []domain.OrganizationConfig, err error)
- func (s *Service) Delete(ctx context.Context, id domain.OrganizationID) error
- func (s *Service) Filter(ctx context.Context, filter ...domain.OrganizationFilter) ([]*domain.Organization, error)
- func (s *Service) Get(ctx context.Context, id domain.OrganizationID) (*domain.Organization, error)
- func (s *Service) Put(ctx context.Context, org *domain.Organization) error
- func (s *Service) ResolveOrgByDomain(next http.Handler) http.Handler
- func (s *Service) RetrieveConfig(orgID string) (cfg domain.OrganizationConfig, ok bool)
- func (s *Service) Routes(pattern string, r chi.Router)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) SetServiceBuilder(b *domain.ServiceBuilder)
- func (s *Service) Shutdown(ctx context.Context) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterOption ¶ added in v0.1.8
type FilterOption struct { // OffSet is the start of the list where OffSet int Limit int Org domain.Organization }
type Option ¶ added in v0.2.0
func SetDomainRoutes ¶ added in v0.2.0
func SetDomainRoutes() Option
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages all interactions with domain.Organization Store
func NewService ¶
NewService creates an organization.Service. The organization.Store implementation is the storage backend for the service.
func (*Service) AddOrgs ¶ added in v0.3.0
func (s *Service) AddOrgs(orgs map[string]domain.OrganizationConfig) error
func (*Service) Filter ¶ added in v0.1.8
func (s *Service) Filter(ctx context.Context, filter ...domain.OrganizationFilter) ([]*domain.Organization, error)
Filter returns a list of domain.Organization based on the filterOptions.
When the filterOptions are nil, the first 10 are returned.
func (*Service) Get ¶
func (s *Service) Get(ctx context.Context, id domain.OrganizationID) (*domain.Organization, error)
Get returns an domain.Organization and returns ErrOrgNotFound when the Organization is not found.
func (*Service) ResolveOrgByDomain ¶ added in v0.2.0
ResolveOrgByDomain adds a domain.OrganizationID to the context by domain. If the domain cannot be resolved it will return a http.StatusBadRequest.
GetOrganizationID can be used to retrieve the domain.OrganizationID from the request context.
func (*Service) RetrieveConfig ¶ added in v0.3.0
func (s *Service) RetrieveConfig(orgID string) (cfg domain.OrganizationConfig, ok bool)
RetrieveConfig returns a domain.OrganizationConfig. When it is not found false is returned
func (*Service) ServeHTTP ¶ added in v0.3.0
func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*Service) SetServiceBuilder ¶ added in v0.3.0
func (s *Service) SetServiceBuilder(b *domain.ServiceBuilder)
type Store ¶
type Store interface { Delete(ctx context.Context, id domain.OrganizationID) error Get(ctx context.Context, id domain.OrganizationID) (*domain.Organization, error) Filter(ctx context.Context, filter ...domain.OrganizationFilter) ([]*domain.Organization, error) Put(ctx context.Context, org *domain.Organization) error Shutdown(ctx context.Context) error }
Store is the storage interface for the organization.Service.