Documentation ¶
Index ¶
- func DecodeBase64String(in string) (out []byte, err error)
- func FileExists(path string) (bool, error)
- func IsTruthy(str string) bool
- func RandomString() (string, error)
- func WatchFolder(ctx context.Context, folder string, logger *zerolog.Logger) (<-chan struct{}, error)
- type AppLogger
- func (a *AppLogger) Init() error
- func (a *AppLogger) InitWithWriter(out io.Writer) error
- func (a *AppLogger) Log(c *gin.Context) *zerolog.Logger
- func (a *AppLogger) LoggerMaskMiddleware(exp *regexp.Regexp, replace string) gin.HandlerFunc
- func (a *AppLogger) LoggerMiddleware(c *gin.Context)
- func (a *AppLogger) Raw() *zerolog.Logger
- func (a *AppLogger) SetLogLevel(level zerolog.Level)
- type Broker
- type Webhook
- type WebhookRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64String ¶
DecodeBase64String is a flexible base64 decoder that supports both standard and url encodings, and considers padding optional
func FileExists ¶
FileExists returns true if a file exists on disk and is a regular file
func IsTruthy ¶
IsTruthy returns true if a string is truthy, such as "1", "on", "yes", "true", "t", "y"
func RandomString ¶
RandomString generates a random string of 20 base64url-encoded characters
Types ¶
type AppLogger ¶
type AppLogger struct { // Optional "app" field to add App string // contains filtered or unexported fields }
AppLogger is used to write custom logs
func (*AppLogger) InitWithWriter ¶
InitWithWriter inits the object with a specified output writer
func (*AppLogger) LoggerMaskMiddleware ¶
LoggerMaskMiddleware returns a Gin middleware that adds the "log-mask" to mask the path using a regular expression
func (*AppLogger) LoggerMiddleware ¶
LoggerMiddleware is a Gin middleware that uses zerlog for logging
func (*AppLogger) SetLogLevel ¶
SetLogLevel updates the logger to set
type Broker ¶
type Broker[T any] struct { // contains filtered or unexported fields }
Broker is a message broker that publishes events to all subscribers
func (*Broker[T]) Publish ¶
func (b *Broker[T]) Publish(msg T)
Publish sends a message to all subscribers
func (*Broker[T]) Shutdown ¶
func (b *Broker[T]) Shutdown()
Shutdown forcefully closes all subscriptions Then, it marks the broker as shut down
func (*Broker[T]) Unsubscribe ¶
func (b *Broker[T]) Unsubscribe(ch chan T)
Unsubscribe removes a subscription The channel is closed by this method
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook client
func (*Webhook) SendWebhook ¶
func (w *Webhook) SendWebhook(ctx context.Context, data *WebhookRequest) (err error)
SendWebhook sends the notification