mongo.go重构

This commit is contained in:
2025-12-30 09:53:06 +08:00
parent 55e8a829de
commit 7d05387104

View File

@@ -29,9 +29,13 @@ type MongoDB struct {
Cache bool Cache bool
} }
func DB(cache bool) *MongoDB { func DB(cache ...bool) *MongoDB {
b := true
if len(cache) > 0 {
b = cache[0]
}
return &MongoDB{ return &MongoDB{
Cache: cache, Cache: b,
} }
} }