Documentation ¶
Index ¶
- Variables
- func InitConfigurationStorage(settings model.ConfigurationStorageSettings, serverConfigPath string) (model.ConfigurationStorage, error)
- func NewServer(settings model.ServerSettings, db DatabaseComposer, ...) (model.Server, error)
- type Composer
- type DatabaseComposer
- type PartialDatabaseComposer
- type Server
- func (s *Server) AppStorage() model.AppStorage
- func (s *Server) Close()
- func (s *Server) ConfigurationStorage() model.ConfigurationStorage
- func (s *Server) ImportApps(filename string) error
- func (s *Server) ImportUsers(filename string) error
- func (s *Server) Router() model.Router
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) StaticFilesStorage() model.StaticFilesStorage
- func (s *Server) TokenBlacklist() model.TokenBlacklist
- func (s *Server) TokenStorage() model.TokenStorage
- func (s *Server) UserStorage() model.UserStorage
- func (s *Server) VerificationCodeStorage() model.VerificationCodeStorage
Constants ¶
This section is empty.
Variables ¶
var ServerSettings model.ServerSettings
ServerSettings are server settings.
Functions ¶
func InitConfigurationStorage ¶
func InitConfigurationStorage(settings model.ConfigurationStorageSettings, serverConfigPath string) (model.ConfigurationStorage, error)
InitConfigurationStorage initializes configuration storage.
func NewServer ¶
func NewServer(settings model.ServerSettings, db DatabaseComposer, configurationStorage model.ConfigurationStorage, cors *model.CorsOptions, options ...func(*Server) error) (model.Server, error)
NewServer creates backend service.
Types ¶
type Composer ¶
type Composer struct {
// contains filtered or unexported fields
}
Composer is a service composer which is agnostic to particular database implementations.
func NewComposer ¶
func NewComposer(settings model.ServerSettings, partialComposers []PartialDatabaseComposer, options ...func(*Composer) error) (*Composer, error)
NewComposer returns new database composer based on passed server settings.
func (*Composer) Compose ¶
func (c *Composer) Compose() ( model.AppStorage, model.UserStorage, model.TokenStorage, model.TokenBlacklist, model.VerificationCodeStorage, error, )
Compose composes all services.
type DatabaseComposer ¶
type DatabaseComposer interface { Compose() ( model.AppStorage, model.UserStorage, model.TokenStorage, model.TokenBlacklist, model.VerificationCodeStorage, error, ) }
DatabaseComposer inits database stack.
type PartialDatabaseComposer ¶
type PartialDatabaseComposer interface { AppStorageComposer() func() (model.AppStorage, error) UserStorageComposer() func() (model.UserStorage, error) TokenStorageComposer() func() (model.TokenStorage, error) TokenBlacklistComposer() func() (model.TokenBlacklist, error) VerificationCodeStorageComposer() func() (model.VerificationCodeStorage, error) }
PartialDatabaseComposer can init services backed with different databases.
type Server ¶
Server is a server.
func (*Server) AppStorage ¶
func (s *Server) AppStorage() model.AppStorage
AppStorage returns server's app storage.
func (*Server) ConfigurationStorage ¶
func (s *Server) ConfigurationStorage() model.ConfigurationStorage
ConfigurationStorage returns server's configuration storage.
func (*Server) ImportApps ¶
ImportApps imports apps from file.
func (*Server) ImportUsers ¶
ImportUsers imports users from file.
func (*Server) StaticFilesStorage ¶
func (s *Server) StaticFilesStorage() model.StaticFilesStorage
StaticFilesStorage returns server's static files storage.
func (*Server) TokenBlacklist ¶
func (s *Server) TokenBlacklist() model.TokenBlacklist
TokenBlacklist returns server's token blacklist.
func (*Server) TokenStorage ¶
func (s *Server) TokenStorage() model.TokenStorage
TokenStorage returns server's token storage.
func (*Server) UserStorage ¶
func (s *Server) UserStorage() model.UserStorage
UserStorage returns server's user storage.
func (*Server) VerificationCodeStorage ¶
func (s *Server) VerificationCodeStorage() model.VerificationCodeStorage
VerificationCodeStorage returns server's token storage.