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 DoGetRequest(url string, hdr *fasthttp.ResponseHeader) (*fasthttp.Response, error)
- func DoPostRequest(url string, params map[string]string, hdr *fasthttp.RequestHeader) (*fasthttp.Response, error)
- func DoRequest(url string, params map[string]string) (*fasthttp.Response, error)
- func DoRequestAndKeep(url string, params map[string]string, ch chan<- *fasthttp.Response) error
- func ExampLeSendEmail()
- 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 HandleShowDebugServer(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HandleShowErrorsServer(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HandleShowLogServer(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HandleShowPostgresLog(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HandleShowStatusServer(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HandleStatusDB(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HandleStatusServer(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HandleStatusServices(ctx *fasthttp.RequestCtx) (interface{}, error)
- func HashPassword(password []byte) uint32
- func InitServices(ctx context.Context, list ...string) *rootServices
- func RunGrep(stdout []byte, params ...string) ([]byte, error)
- func RunPostgresqlLog(params string) ([]byte, error)
- 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
- type ShowLogsEngine
- func (s ShowLogsEngine) Close(out chan<- interface{}) error
- func (s ShowLogsEngine) Connect(in <-chan interface{}) (out chan interface{}, err error)
- func (s ShowLogsEngine) Get(ctx context.Context, messages ...interface{}) (response interface{}, err error)
- func (s ShowLogsEngine) Init(ctx context.Context) error
- func (s ShowLogsEngine) Send(ctx context.Context, messages ...interface{}) error
- func (s ShowLogsEngine) Status() string
Constants ¶
const ( ShowStatus = "/api/status/" ShowDBStatus = "/api/status/db" ShowPsqlLog = "/api/status/psql" ShowStatusServices = "/api/status/services" ShowLog = "/api/log/" ShowDebugLog = "/api/log/debug/" ShowErrorsLog = "/api/log/errors/" ShowFEUpdateLog = "/api/log/errors/front/update/" ShowInfoLog = "/api/log/info/" )
const PATH_FLAG = "-path"
PATH_FLAG - сиситемая константа - флаг пути к файлам конфигурации.
const (
SHOW_LOG_CMD = "show_log_cmd"
)
param of log showing
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 DoGetRequest ¶
func DoPostRequest ¶ added in v1.2.57
func DoRequestAndKeep ¶
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 HandleShowDebugServer ¶
func HandleShowDebugServer(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleShowDebugServer show debug messages @/api/log/debug/
func HandleShowErrorsServer ¶
func HandleShowErrorsServer(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleShowErrorsServer show services errors @/api/log/errors/
func HandleShowLogServer ¶
func HandleShowLogServer(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleShowLogServer show logs messages @/api/log/
func HandleShowPostgresLog ¶
func HandleShowPostgresLog(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleShowPostgresLog show services errors @/api/status/psql
func HandleShowStatusServer ¶
func HandleShowStatusServer(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleShowStatusServer show status message @/api/log/info/
func HandleStatusDB ¶
func HandleStatusDB(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleLogServer show status httpgo @/api/status/
func HandleStatusServer ¶
func HandleStatusServer(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleLogServer show status httpgo @/api/status/
func HandleStatusServices ¶
func HandleStatusServices(ctx *fasthttp.RequestCtx) (interface{}, error)
HandleLogServer show status services @/api/status/services
func HashPassword ¶
HashPassword create hash from {password} & return checksumm
func InitServices ¶
InitServices started all services from sServices.services in some goroutins
func RunPostgresqlLog ¶
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
type Mail ¶
type Mail struct { From string To string Subject string ContentType string Body string Attachments []string }
Mail - тип данных для письма
type ShowLogsEngine ¶
type ShowLogsEngine struct {
// contains filtered or unexported fields
}
func (ShowLogsEngine) Close ¶
func (s ShowLogsEngine) Close(out chan<- interface{}) error
func (ShowLogsEngine) Connect ¶
func (s ShowLogsEngine) Connect(in <-chan interface{}) (out chan interface{}, err error)
func (ShowLogsEngine) Get ¶
func (s ShowLogsEngine) Get(ctx context.Context, messages ...interface{}) (response interface{}, err error)
func (ShowLogsEngine) Send ¶
func (s ShowLogsEngine) Send(ctx context.Context, messages ...interface{}) error
func (ShowLogsEngine) Status ¶
func (s ShowLogsEngine) Status() string