Releases: nekomeowww/fo
Releases · nekomeowww/fo
v1.4.0
- feat: new WithZapLoggerFuncHandler for zap logger
Quite useful with zap logger when working with loads of different omitting error handling use cases:
may := fo.NewMay()
may.Use(fo.WithZapLoggerHandler(zapLogger))
may.Invoke(os.Open("./test_file.json"), "failed to open file", zap.String("file", "test_file.json"))
or having this pattern in https://github.com/nekomeowww/insights-bot/blob/967fa028caf356b0a96eaf19d85dcaa2968bbd1f/internal/services/autorecap/autorecap.go#L462-L465
func handleMessage() {
may.Invoke(m.botService.UnpinChatMessage(tgbot.NewUnpinChatMessageConfig(chatID, lastPinnedMessage.MessageID)), "failed to unpin chat message", zap.Int64("chat_id", chatID), zap.Int("message_id", lastPinnedMessage.MessageID))
may.Invoke(m.chathistories.UpdatePinnedMessage(lastPinnedMessage.ChatID, lastPinnedMessage.MessageID, false), "failed to save one telegram sent message", zap.Int64("chat_id", lastPinnedMessage.ChatID), zap.Int("message_id", lastPinnedMessage.MessageID))
may.Invoke(m.botService.PinChatMessage(tgbot.NewPinChatMessageConfig(chatID, sentMsg.MessageID)), "failed to pin chat message", zap.Int64("chat_id", chatID), zap.Int("message_id", sentMsg.MessageID))
may.Invoke(m.chathistories.SaveOneTelegramSentMessage(&sentMsg, true), "failed to save one telegram sent message")
}
Full Changelog: v1.3.0...v1.4.0
v1.3.0
Full Changelog: v1.2.1...v1.3.0
v1.2.1
v1.1.2
- Updated to go1.21
Full Changelog: v1.1.1...v1.1.2
v1.1.1
v1.1.0
Breaking change
- removed package level
CollectAsError(...)
,CollectAsErrors(...)
,HandleErrors(...)
,HandleErrorsWithReturns(...)
functions, now these functions has become the member methods ofMayInvoker*
.
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Published