service

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Configuration map[string]interface{}
	Context       context.Context
}

func NewContext

func NewContext() *Context

func (*Context) GetConfig

func (c *Context) GetConfig(path string, def interface{}) any

func (*Context) SetValue

func (c *Context) SetValue(key string, value interface{})

type ErrorResponse

type ErrorResponse map[string]interface{}

type Handler

type Handler map[string]HandlerElement

type HandlerElement

type HandlerElement struct {
	Name        string
	Description string
	Function    HandlerFunc
	Middlewares []Middleware
}

type HandlerFunc

type HandlerFunc = func(interface{}, interface{}) (interface{}, int, error)

type JsonRequestType

type JsonRequestType struct {
	Method   string
	Metadata map[string]interface{}
	Data     interface{}
}

type Middleware

type Middleware func(next HandlerFunc, data interface{}, metadata interface{}) (interface{}, int, error)

type Service

type Service struct {
	Name        string
	Context     *Context
	Handlers    Handler
	Tasks       []func()
	InitTask    func()
	Logger      *zap.Logger
	Middlewares []Middleware
}

func NewService

func NewService(name string) *Service

func (*Service) ExecuteCommand

func (s *Service) ExecuteCommand(path string, data string) error

func (*Service) GetBuild

func (s *Service) GetBuild(def string) string

func (*Service) GetConfig

func (s *Service) GetConfig(path string, def interface{}) interface{}

func (*Service) RegisterConfig

func (s *Service) RegisterConfig(path string)

func (*Service) RegisterHandlers

func (s *Service) RegisterHandlers(handlers Handler)

func (*Service) RegisterInitTask

func (s *Service) RegisterInitTask(initTask func())

func (*Service) RegisterMiddlewares

func (s *Service) RegisterMiddlewares(middlewares []Middleware)

func (*Service) RegisterTasks

func (s *Service) RegisterTasks(tasks []func())

func (*Service) SetLogger

func (s *Service) SetLogger()

func (*Service) Start

func (s *Service) Start()

func (*Service) StartHttp

func (s *Service) StartHttp()

func (*Service) StartServices

func (s *Service) StartServices()

func (*Service) StartSocket

func (s *Service) StartSocket()

func (*Service) StartTasks

func (s *Service) StartTasks()

func (*Service) StartWS

func (s *Service) StartWS()

Jump to

Keyboard shortcuts

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