@@ -33,7 +33,22 @@ func NewMongoLoader(db *mongo.Database, collectionName string, modelType reflect
3333func NewLoader (db * mongo.Database , collectionName string , modelType reflect.Type , options ... func (context.Context , interface {}) (interface {}, error )) * Loader {
3434 return NewMongoLoader (db , collectionName , modelType , false , options ... )
3535}
36-
36+ func UseMongoLoad (db * mongo.Database , collectionName string , modelType reflect.Type , idObjectId bool , options ... func (context.Context , interface {}) (interface {}, error )) func (context.Context , interface {}, interface {}) (bool , error ) {
37+ l := NewMongoLoader (db , collectionName , modelType , idObjectId , options ... )
38+ return l .LoadAndDecode
39+ }
40+ func Load (db * mongo.Database , collectionName string , modelType reflect.Type , options ... func (context.Context , interface {}) (interface {}, error )) func (context.Context , interface {}, interface {}) (bool , error ) {
41+ return UseMongoLoad (db , collectionName , modelType , false , options ... )
42+ }
43+ func UseLoad (db * mongo.Database , collectionName string , modelType reflect.Type , options ... func (context.Context , interface {}) (interface {}, error )) func (context.Context , interface {}, interface {}) (bool , error ) {
44+ return UseMongoLoad (db , collectionName , modelType , false , options ... )
45+ }
46+ func UseGet (db * mongo.Database , collectionName string , modelType reflect.Type , options ... func (context.Context , interface {}) (interface {}, error )) func (context.Context , interface {}, interface {}) (bool , error ) {
47+ return UseMongoLoad (db , collectionName , modelType , false , options ... )
48+ }
49+ func Get (db * mongo.Database , collectionName string , modelType reflect.Type , options ... func (context.Context , interface {}) (interface {}, error )) func (context.Context , interface {}, interface {}) (bool , error ) {
50+ return UseMongoLoad (db , collectionName , modelType , false , options ... )
51+ }
3752func (m * Loader ) Id () string {
3853 return m .jsonIdName
3954}
0 commit comments