Compare commits

..

No commits in common. "108691267db2852ea2d1e6815470c9baccf42493" and "829374cc1435e33ff031c261e718adf82181bdd1" have entirely different histories.

1 changed files with 2 additions and 2 deletions

View File

@ -143,13 +143,13 @@ func GetTableName(model any) string {
// GetCollectionDao 获取文档操作接口
// key: 平台id 或 KeyGlobal
// database: 数据库类型 DatabaseType
// f: 文档接口创建函数; 结合 tools/mongoctl 生成
// f: 文档接口创建函数
func GetCollectionDao[T any](key string, database DatabaseType, model any, f func(database *mongo.Database, c *mongo.Collection) T) (T, error) {
collectionName := GetTableName(model)
c, err := GetCollection(key, database, collectionName)
if err != nil {
var z T
logger.Logger.Errorf("GetCollectionDao key:%v database:%v model:%v error: %v", key, database, collectionName, err)
logger.Logger.Errorf("GetCollectionModel key:%v database:%v model:%v error: %v", key, database, collectionName, err)
return z, err
}
return f(c.Database.Database, c.Collection), nil