Documentation
¶
Index ¶
- Constants
- Variables
- func AddEndpointNameMetrics(str string, ctx context.Context) context.Context
- func ConvertStringToTimeDate(input string) (time.Time, error)
- func DatePtrToString(date *time.Time) string
- func DatePtrToStringPtr(date *time.Time) *string
- func DateTimeToString(date time.Time) string
- func DateToString(date time.Time) string
- func DateToStringPtr(date time.Time) *string
- func Decrypt(ciphertextHex string, keyStr string) ([]byte, error)
- func Encrypt(plaintext []byte, keyStr string) ([]byte, error)
- func Exec[T ITaskRunner](runner T, shutdowner fx.Shutdowner)
- func Execute[T ITaskRunner]()
- func GenerateHttpClientWithInstrumentation(serviceName string) *http.Client
- func GetHostname() string
- func GetMidnight(t time.Time) time.Time
- func GetTimestamp() string
- func Invoke(invoke interface{})
- func InvokeIf(invoke interface{}, acceptedmodes ...string)
- func NowString() string
- func NowTime() time.Time
- func Populate(top interface{})
- func Provides(methods ...interface{})
- func ProvidesAndSupplyIf(provide interface{}, supply interface{}, acceptedmodes ...string)
- func ProvidesIf(provide interface{}, acceptedmodes ...string)
- func ReadConfig(projectConfigFile, ConfigFileEnvVar string, appconfig any) error
- func Run()
- func Start(ctx context.Context) (*fx.App, error)
- func StringPtrToString(s *string) string
- func StringToDatePtr(date string) *time.Time
- func StringToDateTime(date string) time.Time
- func StringToDateTimePtr(date string) *time.Time
- func Supply(ifaces ...interface{})
- func SupplyIf(iface interface{}, acceptedmodes ...string)
- type ApplicationError
- func BusinessErrorWithCodeAndMessage(code, message string) *ApplicationError
- func BusinessErrorWithError(err error) *ApplicationError
- func NotFoundError() *ApplicationError
- func StringToDate(date string) (time.Time, *ApplicationError)
- func TechnicalErrorWithCodeAndMessage(code, message string) *ApplicationError
- func TechnicalErrorWithError(err error) *ApplicationError
- func ValidateStruct(i interface{}) *ApplicationError
- type Config
- type FlagDefinition
- type ITaskRunner
- type MetricLogHook
- type ServerMetrics
- type Tracer
Constants ¶
View Source
const ( DateFormat = "2006-01-02" DateTimeFormat = "2006-01-02 15:04:05" DateTimeZoneFormat = "2006-01-02T15:04:05.999Z07:00" )
View Source
const ErrValidation = "ERR_VALIDATION"
Variables ¶
View Source
var AppName string
View Source
var BuildDate string
View Source
var BuildVersion string
View Source
var HealthHandler http.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte("OK")) })
HealthHandler is a simple liveness endpoint that always returns HTTP 200 OK.
View Source
var Logo []byte
View Source
var Mode = os.Getenv("MODE")
View Source
var SHA string
View Source
var Task = &cobra.Command{}
View Source
var TaskConfig any
View Source
var Validator = validator.New()
Functions ¶
func AddEndpointNameMetrics ¶
func DatePtrToString ¶ added in v0.0.3
func DatePtrToStringPtr ¶ added in v0.0.3
func DateTimeToString ¶
func DateToString ¶
func DateToStringPtr ¶
func Decrypt ¶ added in v0.0.19
decrypt decritta un messaggio esadecimale usando l'AppID come chiave. Il nonce è atteso all'inizio del ciphertext decodificato da hex.
func Exec ¶ added in v0.0.11
func Exec[T ITaskRunner](runner T, shutdowner fx.Shutdowner)
func Execute ¶ added in v0.0.5
func Execute[T ITaskRunner]()
func GetHostname ¶
func GetHostname() string
func GetTimestamp ¶
func GetTimestamp() string
func ProvidesAndSupplyIf ¶
func ProvidesAndSupplyIf(provide interface{}, supply interface{}, acceptedmodes ...string)
func ProvidesIf ¶
func ProvidesIf(provide interface{}, acceptedmodes ...string)
func ReadConfig ¶
func StringPtrToString ¶ added in v0.0.4
func StringToDatePtr ¶
func StringToDateTime ¶
func StringToDateTimePtr ¶
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 ValidateStruct ¶ added in v0.0.4
func ValidateStruct(i interface{}) *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 FlagDefinition ¶ added in v0.0.5
type FlagDefinition struct {
// contains filtered or unexported fields
}
type ITaskRunner ¶ added in v0.0.5
type ITaskRunner interface {
Execute()
}
type MetricLogHook ¶
type MetricLogHook struct {
LogEvent metric.Int64Counter
}
LevelHook applies a different hook for each level.
func (*MetricLogHook) Init ¶
func (m *MetricLogHook) Init()
type ServerMetrics ¶
type ServerMetrics struct {
}
func NewServerMetrics ¶
func NewServerMetrics(lc fx.Lifecycle) *ServerMetrics
Source Files
¶
Click to show internal directories.
Click to hide internal directories.