application

package
v0.0.0-...-b3db260 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

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) Delete

func (r *RepoStruct) Delete(id uint) error

Delete record

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

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

CreateService business logic layer for create operation

func (*ServiceStruct) DeleteService

DeleteService business logic layer for delete operation

func (*ServiceStruct) GetService

GetService business logic layer for get operation

func (*ServiceStruct) ListService

ListService business logic layer for list operation

func (*ServiceStruct) UpdateService

UpdateService business logic layer for update operation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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