server

package
v1.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfigurationStorage

func InitConfigurationStorage(config model.ConfigStorageSettings) (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

Compose composes all services.

type DatabaseComposer

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)
	InviteStorageComposer() func() (model.InviteStorage, error)
}

PartialDatabaseComposer can init services backed with different databases.

type Server

type Server struct {
	MainRouter *web.Router
	// contains filtered or unexported fields
}

Server is a server.

func (*Server) AppStorage

func (s *Server) AppStorage() model.AppStorage

AppStorage returns server's app storage.

func (*Server) Close

func (s *Server) Close()

Close closes all database connections.

func (*Server) ConfigurationStorage

func (s *Server) ConfigurationStorage() model.ConfigurationStorage

ConfigurationStorage returns server's configuration storage.

func (*Server) ImportApps

func (s *Server) ImportApps(filename string) error

ImportApps imports apps from file.

func (*Server) ImportUsers

func (s *Server) ImportUsers(filename string) error

ImportUsers imports users from file.

func (*Server) Router

func (s *Server) Router() model.Router

Router returns server's main router.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Settings added in v1.2.9

func (s *Server) Settings() model.ServerSettings

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.

Directories

Path Synopsis
utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL