Documentation ¶
Index ¶
- func Loop(repo RepoInterface) error
- type CLIHandlerInterface
- type CLIHandlerStruct
- func (h *CLIHandlerStruct) CreateCLIHandler(c *cli.Context) error
- func (h *CLIHandlerStruct) DeleteCLIHandler(c *cli.Context) error
- func (h *CLIHandlerStruct) GetCLIHandler(c *cli.Context) error
- func (h *CLIHandlerStruct) ListCLIHandler(c *cli.Context) error
- func (h *CLIHandlerStruct) RegisterCommands(app *cli.App)
- func (h *CLIHandlerStruct) UpdateCLIHandler(c *cli.Context) error
- type HandlerInterface
- type HandlerStruct
- func (h *HandlerStruct) CreateHandler(c *fiber.Ctx) error
- func (h *HandlerStruct) DeleteHandler(c *fiber.Ctx) error
- func (h *HandlerStruct) GetHandler(c *fiber.Ctx) error
- func (h *HandlerStruct) ListHandler(c *fiber.Ctx) error
- func (h *HandlerStruct) RegisterHandlers(app *fiber.App)
- func (h *HandlerStruct) UpdateHandler(c *fiber.Ctx) error
- type RepoInterface
- type RepoStruct
- func (r *RepoStruct) Create(application *models.Application) (uint, error)
- func (r *RepoStruct) Delete(id uint) error
- func (r *RepoStruct) Get(id uint) (*models.Application, error)
- func (r *RepoStruct) List(page, limit int) (*[]models.Application, error)
- func (r *RepoStruct) Update(application *models.Application) (uint, error)
- type ServiceInterface
- type ServiceStruct
- func (s *ServiceStruct) CreateService(req models.ApplicationCreateReq) (*models.ApplicationCreateRes, error)
- func (s *ServiceStruct) DeleteService(req models.ApplicationDeleteReq) (*models.ApplicationDeleteRes, error)
- func (s *ServiceStruct) GetService(req models.ApplicationGetReq) (*models.ApplicationGetRes, error)
- func (s *ServiceStruct) ListService(req models.ApplicationListReq) (*models.ApplicationListRes, error)
- func (s *ServiceStruct) UpdateService(req models.ApplicationUpdateReq) (*models.ApplicationUpdateRes, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Loop ¶
func Loop(repo RepoInterface) error
Loop starts loop for every application with given interval, if application config changes cancels to all go routines and creates again
Types ¶
type CLIHandlerInterface ¶
type CLIHandlerInterface interface { CreateCLIHandler(c *cli.Context) error UpdateCLIHandler(c *cli.Context) error GetCLIHandler(c *cli.Context) error ListCLIHandler(c *cli.Context) error DeleteCLIHandler(c *cli.Context) error RegisterCommands(app *cli.App) }
CLIHandlerInterface contains handler functions
func NewCLIHandler ¶
func NewCLIHandler(service ServiceInterface) CLIHandlerInterface
NewCLIHandler returns new CLIHandlerStruct / CLIHandlerInterface with service
type CLIHandlerStruct ¶
type CLIHandlerStruct struct {
// contains filtered or unexported fields
}
CLIHandlerStruct
func (*CLIHandlerStruct) CreateCLIHandler ¶
func (h *CLIHandlerStruct) CreateCLIHandler(c *cli.Context) error
CreateCLIHandler validates create request and sends to service
func (*CLIHandlerStruct) DeleteCLIHandler ¶
func (h *CLIHandlerStruct) DeleteCLIHandler(c *cli.Context) error
DeleteCLIHandler validates get request and sends to service
func (*CLIHandlerStruct) GetCLIHandler ¶
func (h *CLIHandlerStruct) GetCLIHandler(c *cli.Context) error
GetCLIHandler validates get request and sends to service
func (*CLIHandlerStruct) ListCLIHandler ¶
func (h *CLIHandlerStruct) ListCLIHandler(c *cli.Context) error
ListCLIHandler validates list request and sends to service
func (*CLIHandlerStruct) RegisterCommands ¶
func (h *CLIHandlerStruct) RegisterCommands(app *cli.App)
RegisterCommands registers cli commands
func (*CLIHandlerStruct) UpdateCLIHandler ¶
func (h *CLIHandlerStruct) UpdateCLIHandler(c *cli.Context) error
UpdateCLIHandler validates update request and sends to service
type HandlerInterface ¶
type HandlerInterface interface { CreateHandler(c *fiber.Ctx) error UpdateHandler(c *fiber.Ctx) error GetHandler(c *fiber.Ctx) error ListHandler(c *fiber.Ctx) error DeleteHandler(c *fiber.Ctx) error RegisterHandlers(app *fiber.App) }
HandlerInterface contains handler functions
func NewHandler ¶
func NewHandler(service ServiceInterface) HandlerInterface
NewHandler returns new HandlerStruct / HandlerInterface with service
type HandlerStruct ¶
type HandlerStruct struct {
// contains filtered or unexported fields
}
HandlerStruct
func (*HandlerStruct) CreateHandler ¶
func (h *HandlerStruct) CreateHandler(c *fiber.Ctx) error
CreateHandler validates create request and sends to service
func (*HandlerStruct) DeleteHandler ¶
func (h *HandlerStruct) DeleteHandler(c *fiber.Ctx) error
DeleteHandler validates get request and sends to service
func (*HandlerStruct) GetHandler ¶
func (h *HandlerStruct) GetHandler(c *fiber.Ctx) error
GetHandler validates get request and sends to service
func (*HandlerStruct) ListHandler ¶
func (h *HandlerStruct) ListHandler(c *fiber.Ctx) error
ListHandler validates list request and sends to service
func (*HandlerStruct) RegisterHandlers ¶
func (h *HandlerStruct) RegisterHandlers(app *fiber.App)
RegisterHandlers registers handlers to fiber app
func (*HandlerStruct) UpdateHandler ¶
func (h *HandlerStruct) UpdateHandler(c *fiber.Ctx) error
UpdateHandler validates update request and sends to service
type RepoInterface ¶
type RepoInterface interface { Create(application *models.Application) (uint, error) Update(application *models.Application) (uint, error) Get(id uint) (*models.Application, error) List(page, limit int) (*[]models.Application, error) Delete(id uint) error }
RepoInterface contains repo functions
func NewRepo ¶
func NewRepo(db *gorm.DB) RepoInterface
NewRepo returns new RepoStruct / RepoInterface with db
type RepoStruct ¶
type RepoStruct struct {
// contains filtered or unexported fields
}
RepoStruct
func (*RepoStruct) Create ¶
func (r *RepoStruct) Create(application *models.Application) (uint, error)
Create creates new record with gorm.Create function
func (*RepoStruct) Get ¶
func (r *RepoStruct) Get(id uint) (*models.Application, error)
Get finds first record with the given id and gorm.First function
func (*RepoStruct) List ¶
func (r *RepoStruct) List(page, limit int) (*[]models.Application, error)
List finds records with given page and limit parameters
func (*RepoStruct) Update ¶
func (r *RepoStruct) Update(application *models.Application) (uint, error)
Update updates a record with gorm.Updates function
type ServiceInterface ¶
type ServiceInterface interface { CreateService(req models.ApplicationCreateReq) (*models.ApplicationCreateRes, error) UpdateService(req models.ApplicationUpdateReq) (*models.ApplicationUpdateRes, error) GetService(req models.ApplicationGetReq) (*models.ApplicationGetRes, error) ListService(req models.ApplicationListReq) (*models.ApplicationListRes, error) DeleteService(req models.ApplicationDeleteReq) (*models.ApplicationDeleteRes, error) }
ServiceInterface contains service functions
func NewService ¶
func NewService(repo RepoInterface) ServiceInterface
NewService returns new ServiceStruct / ServiceInterface with repo
type ServiceStruct ¶
type ServiceStruct struct {
// contains filtered or unexported fields
}
ServiceStruct
func (*ServiceStruct) CreateService ¶
func (s *ServiceStruct) CreateService(req models.ApplicationCreateReq) (*models.ApplicationCreateRes, error)
CreateService business logic layer for create operation
func (*ServiceStruct) DeleteService ¶
func (s *ServiceStruct) DeleteService(req models.ApplicationDeleteReq) (*models.ApplicationDeleteRes, error)
DeleteService business logic layer for delete operation
func (*ServiceStruct) GetService ¶
func (s *ServiceStruct) GetService(req models.ApplicationGetReq) (*models.ApplicationGetRes, error)
GetService business logic layer for get operation
func (*ServiceStruct) ListService ¶
func (s *ServiceStruct) ListService(req models.ApplicationListReq) (*models.ApplicationListRes, error)
ListService business logic layer for list operation
func (*ServiceStruct) UpdateService ¶
func (s *ServiceStruct) UpdateService(req models.ApplicationUpdateReq) (*models.ApplicationUpdateRes, error)
UpdateService business logic layer for update operation