From 7d0538710468a4b777d2d8cb2a1ac60503de5a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=8C?= <259278618@qq.com> Date: Tue, 30 Dec 2025 09:53:06 +0800 Subject: [PATCH] =?UTF-8?q?mongo.go=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mongo/mongo.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mongo/mongo.go b/mongo/mongo.go index 4c3855f..d0bff5f 100644 --- a/mongo/mongo.go +++ b/mongo/mongo.go @@ -29,9 +29,13 @@ type MongoDB struct { Cache bool } -func DB(cache bool) *MongoDB { +func DB(cache ...bool) *MongoDB { + b := true + if len(cache) > 0 { + b = cache[0] + } return &MongoDB{ - Cache: cache, + Cache: b, } }