core

package module
v0.0.0-...-0e70cb6 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 25 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DateFormat         = "2006-01-02"
	DateTimeFormat     = "2006-01-02 15:04:05"
	DateTimeZoneFormat = "2006-01-02T15:04:05.999Z07:00"
)

Variables

View Source
var AppName string
View Source
var BuildDate string
View Source
var BuildVersion string
View Source
var Mode = os.Getenv("MODE")

Functions

func AddEndpointNameMetrics

func AddEndpointNameMetrics(str string, ctx context.Context) context.Context

func ConvertStringToTimeDate

func ConvertStringToTimeDate(input string) (time.Time, error)

func DateTimeToString

func DateTimeToString(date time.Time) string

func DateToString

func DateToString(date time.Time) string

func DateToStringPtr

func DateToStringPtr(date time.Time) *string

func GenerateHttpClientWithInstrumentation

func GenerateHttpClientWithInstrumentation(serviceName string) *http.Client

func GetHostname

func GetHostname() string

func GetTimestamp

func GetTimestamp() string

func Invoke

func Invoke(invoke interface{})

func InvokeIf

func InvokeIf(invoke interface{}, acceptedmodes ...string)

func NowString

func NowString() string

func NowTime

func NowTime() time.Time

func Provides

func Provides(methods ...interface{})

func ProvidesAndSupplyIf

func ProvidesAndSupplyIf(provide interface{}, supply interface{}, acceptedmodes ...string)

func ProvidesIf

func ProvidesIf(provide interface{}, acceptedmodes ...string)

func ReadConfig

func ReadConfig(projectConfigFile, ConfigFileEnvVar string, appconfig any) error

func Start

func Start()

func StringToDatePtr

func StringToDatePtr(date string) *time.Time

func StringToDateTime

func StringToDateTime(date string) time.Time

func StringToDateTimePtr

func StringToDateTimePtr(date string) *time.Time

func Supply

func Supply(ifaces ...interface{})

func SupplyIf

func SupplyIf(iface interface{}, acceptedmodes ...string)

Types

type ApplicationError

type ApplicationError struct {
	StatusCode int    `json:"-" bson:"statusCode"`
	Ambit      string `json:"ambit"`
	Code       string `json:"code"`
	Message    string `json:"message"`
}

func BusinessErrorWithCodeAndMessage

func BusinessErrorWithCodeAndMessage(code, message string) *ApplicationError

func BusinessErrorWithError

func BusinessErrorWithError(err error) *ApplicationError

func NotFoundError

func NotFoundError() *ApplicationError

func StringToDate

func StringToDate(date string) (time.Time, *ApplicationError)

func TechnicalErrorWithCodeAndMessage

func TechnicalErrorWithCodeAndMessage(code, message string) *ApplicationError

func TechnicalErrorWithError

func TechnicalErrorWithError(err error) *ApplicationError

func (*ApplicationError) Error

func (m *ApplicationError) Error() string

func (*ApplicationError) GetStatus

func (m *ApplicationError) GetStatus() int

func (*ApplicationError) IsBusinessError

func (m *ApplicationError) IsBusinessError() bool

func (*ApplicationError) IsTechnicalError

func (m *ApplicationError) IsTechnicalError() bool

type Config

type Config struct {
	Log struct {
		Ignore     bool
		Level      string
		EnableJSON bool
	}
	AppConfig any `yaml:"config" mapstructure:"config" json:"config"`
}

type ServerMetrics

type ServerMetrics struct {
}

func NewServerMetrics

func NewServerMetrics(lc fx.Lifecycle) *ServerMetrics

type Tracer

type Tracer struct {
	TracerProvider *trace.TracerProvider
}

func NewOtelTracer

func NewOtelTracer(lc fx.Lifecycle) *Tracer

Jump to

Keyboard shortcuts

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