service

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 28 Imported by: 2

README

Framework base for all services

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleWithTransaction added in v0.2.2

func HandleWithTransaction(http *httpserver.HttpServer, trxItf transaction.TransactionInterface, handler WrappedHandlerFunc) gin.HandlerFunc

func NewValidator added in v0.2.6

func NewValidator() (*validation.Validator, error)

func Run

func Run(serviceName string, options Options, serviceLogic func(ctx context.Context, baseService *BaseService) error)

func WithTransaction added in v0.2.2

func WithTransaction(ctx context.Context, fn func(db *gorm.DB) error) error

Types

type BaseService

type BaseService struct {
	Config *config.Config
	Probe  *health.Probe

	Validator *validation.Validator

	Environment env.Environment
	// contains filtered or unexported fields
}

func (*BaseService) GetDatabase added in v0.2.2

func (bs *BaseService) GetDatabase() (*database.Database, error)

func (*BaseService) GetHttpServer added in v0.2.2

func (bs *BaseService) GetHttpServer() (*httpserver.HttpServer, error)

func (*BaseService) GetMqPublisher added in v0.2.3

func (bs *BaseService) GetMqPublisher() (*events.Publisher, error)

func (*BaseService) GetMqSubscriber added in v0.2.3

func (bs *BaseService) GetMqSubscriber() (*events.Subscriber, error)

type Options added in v0.2.2

type Options struct {
	UseDatabase bool
	UseEvents   bool
}

type ServiceStartPointMetrics added in v0.2.3

type ServiceStartPointMetrics struct {
	metricsDomain.BaseMetric

	Start int `metric:"start"`
}

TODO: Determine if we should add the version and commit hash to metrics

type WrappedHandlerFunc added in v0.2.1

type WrappedHandlerFunc func(*gin.Context) (any, error)

Directories

Path Synopsis
logger

Jump to

Keyboard shortcuts

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