Documentation ¶
Overview ¶
Package services для подключения сервисов и устроения взаимодействия сервисов с главным потоком
Index ¶
- Constants
- func AddService(name string, pService IService)
- func Close(name string, out chan<- interface{}) error
- func Connect(name string, in <-chan interface{}) (out chan interface{}, err error)
- func ExamlpeSendEmail()
- func GeneratePassword(email string) (string, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func Get(ctx context.Context, name string, messages ...interface{}) (response interface{}, err error)
- func HashPassword(password []byte) uint32
- func InitServices(ctx context.Context, list ...string) *rootServices
- func Send(ctx context.Context, name string, messages ...interface{}) (err error)
- func Status(name string) string
- func VerifyMail(email, password string)
- type ErrBrokenConnection
- type ErrServiceNotCorrectOperation
- type ErrServiceNotCorrectParamType
- type ErrServiceNotEnoughParameter
- type ErrServiceNotFound
- type ErrServiceNotReady
- type ErrServiceWrongIndex
- type IChildService
- type IService
- type Mail
Constants ¶
const PATH_FLAG = "-path"
PATH_FLAG - сиситемая константа - флаг пути к файлам конфигурации.
const STATUS_ERROR = "error"
STATUS_ERROR - стстус Сервиса - "Ошибка"
const STATUS_PREPARING = "preparing data"
STATUS_PREPARING - стстус Сервиса - "Подготовка сервиса"
const STATUS_READY = "ready"
STATUS_READY - стстус Сервиса - "Готово"
const TYPE_HTML = "text/html"
TYPE_HTML - тип отправляемого сообщения - "HTML"
const TYPE_PLAIN_TEXT = "text/plain"
TYPE_PLAIN_TEXT - тип отправляемого сообщения - "Текст"
Variables ¶
This section is empty.
Functions ¶
func AddService ¶
AddService adding new service with {name} to services list
func ExamlpeSendEmail ¶ added in v1.1.1001
func ExamlpeSendEmail()
ExamlpeSendEmail - пример отправки сообщения
func GeneratePassword ¶
GeneratePassword run password by email
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func Get ¶
func Get(ctx context.Context, name string, messages ...interface{}) (response interface{}, err error)
Get messages to service {name} & return result
func HashPassword ¶
HashPassword create hash from {password} & return checksumm
func InitServices ¶
InitServices started all services from sServices.services in some goroutins
func VerifyMail ¶
func VerifyMail(email, password string)
VerifyMail - проверка на валидность email - адреса
Types ¶
type ErrBrokenConnection ¶
type ErrBrokenConnection struct { Name string Param interface{} }
ErrBrokenConnection for errors broken connection
func (ErrBrokenConnection) Error ¶
func (err ErrBrokenConnection) Error() string
type ErrServiceNotCorrectOperation ¶
ErrServiceNotCorrectOperation for errors if input operation is not valid
func (ErrServiceNotCorrectOperation) Error ¶
func (err ErrServiceNotCorrectOperation) Error() string
type ErrServiceNotCorrectParamType ¶
ErrServiceNotCorrectParamType for errors if parameter is not valid
func (ErrServiceNotCorrectParamType) Error ¶
func (err ErrServiceNotCorrectParamType) Error() string
type ErrServiceNotEnoughParameter ¶
type ErrServiceNotEnoughParameter struct { Name string Param interface{} }
ErrServiceNotEnoughParameter for errors if not found required parameter
func (ErrServiceNotEnoughParameter) Error ¶
func (err ErrServiceNotEnoughParameter) Error() string
type ErrServiceNotFound ¶
type ErrServiceNotFound struct {
Name string
}
ErrServiceNotFound for errors when current service not found
func (ErrServiceNotFound) Error ¶
func (err ErrServiceNotFound) Error() string
type ErrServiceNotReady ¶
ErrServiceNotReady for errors if service not ready
func (ErrServiceNotReady) Error ¶
func (err ErrServiceNotReady) Error() string
type ErrServiceWrongIndex ¶
ErrServiceWrongIndex for errors wrong index in array range TODO: wrote correct comment for this type
func (ErrServiceWrongIndex) Error ¶
func (err ErrServiceWrongIndex) Error() string
type IChildService ¶
IChildService interface of service with parent dependencies
type IService ¶
type IService interface { Init(ctx context.Context) error Send(ctx context.Context, messages ...interface{}) error Get(ctx context.Context, messages ...interface{}) (response interface{}, err error) Connect(in <-chan interface{}) (out chan interface{}, err error) Close(out chan<- interface{}) error Status() string }
IService root service interface