feat: 数据迁移新增实时日志&数据库游标遍历查询问题修复

This commit is contained in:
meilin.huang
2024-03-28 22:20:39 +08:00
parent 5e4793433b
commit d1d372e1bf
31 changed files with 477 additions and 344 deletions

View File

@@ -4,7 +4,7 @@ import "fmt"
const (
AppName = "mayfly-go"
Version = "v1.7.4"
Version = "v1.7.5"
)
func GetAppInfo() string {

View File

@@ -48,6 +48,10 @@ func DebugContext(ctx context.Context, msg string, args ...any) {
Log(ctx, slog.LevelDebug, msg, args...)
}
func DebugfContext(ctx context.Context, format string, args ...any) {
Log(ctx, slog.LevelDebug, fmt.Sprintf(format, args...))
}
func Debugf(format string, args ...any) {
Log(context.Background(), slog.LevelDebug, fmt.Sprintf(format, args...))
}
@@ -69,6 +73,10 @@ func InfoContext(ctx context.Context, msg string, args ...any) {
Log(ctx, slog.LevelInfo, msg, args...)
}
func InfofContext(ctx context.Context, format string, args ...any) {
Log(ctx, slog.LevelInfo, fmt.Sprintf(format, args...))
}
func Infof(format string, args ...any) {
Log(context.Background(), slog.LevelInfo, fmt.Sprintf(format, args...))
}
@@ -85,6 +93,10 @@ func WarnContext(ctx context.Context, msg string, args ...any) {
Log(ctx, slog.LevelWarn, msg, args...)
}
func WarnfContext(ctx context.Context, format string, args ...any) {
Log(ctx, slog.LevelWarn, fmt.Sprintf(format, args...))
}
func Warnf(format string, args ...any) {
Log(context.Background(), slog.LevelWarn, fmt.Sprintf(format, args...))
}
@@ -101,6 +113,10 @@ func ErrorContext(ctx context.Context, msg string, args ...any) {
Log(ctx, slog.LevelError, msg, args...)
}
func ErrorfContext(ctx context.Context, format string, args ...any) {
Log(ctx, slog.LevelError, fmt.Sprintf(format, args...))
}
func Errorf(format string, args ...any) {
Log(context.Background(), slog.LevelError, fmt.Sprintf(format, args...))
}

View File

@@ -42,3 +42,16 @@ func MapValues[M ~map[K]V, K comparable, V any](m M) []V {
}
return r
}
// MapMerge maps merge, 若存在重复的key则以最后的map值为准
func MapMerge[M ~map[K]V, K comparable, V any](maps ...M) M {
mergedMap := make(M)
for _, m := range maps {
for k, v := range m {
mergedMap[k] = v
}
}
return mergedMap
}