Documentation ¶
Index ¶
- Constants
- Variables
- func GetMongoDbClient(uri string) (client *mongo.Client, err error)
- func ToBsonDoc(v interface{}) (doc *bson.D, err error)
- func ToBsonMap(v interface{}) (doc bson.M, err error)
- type AuditAuth
- type DeleteManyResult
- type IBaseRepo
- type IBaseRepoAudit
- type InsertManyResult
- type SubIdName
- type UpdateManyResult
Constants ¶
View Source
const ( DefaultTimeout = time.Second * 30 Insert = "insert" Update = "update" Delete = "delete" )
Variables ¶
View Source
var ErrIndexConvert = errors.New("can't convert index models")
Error by convert index model
View Source
var ErrNotFound = errors.New("not found")
Not Found error
Functions ¶
func GetMongoDbClient ¶ added in v0.8.0
GetMongoDbClient, return new mongo driver client
Types ¶
type AuditAuth ¶ added in v1.0.0
type AuditAuth struct {
User interface{}
}
AuthAudit, auth user for audit
func SetAuditAuth ¶ added in v1.1.1
func SetAuditAuth(user interface{}) *AuditAuth
SetAuditAuthUser, returns AuditAuth with user
type DeleteManyResult ¶ added in v1.2.0
type DeleteManyResult struct {
DeletedCount int64
}
type IBaseRepo ¶ added in v0.8.0
type IBaseRepo interface { CreateIndexes(indexes interface{}, args ...interface{}) ([]string, error) InsertOne(doc interface{}, args ...interface{}) (interface{}, error) InsertMany(docs []interface{}, args ...interface{}) (*InsertManyResult, error) CountDocuments(filter interface{}, args ...interface{}) (int64, error) EstimatedDocumentCount(args ...interface{}) (int64, error) Find(filter interface{}, result interface{}, args ...interface{}) error FindOne(filter interface{}, result interface{}, args ...interface{}) error FindOneAndDelete(filter interface{}, result interface{}, args ...interface{}) error FindOneAndReplace(filter, replacement, result interface{}, args ...interface{}) error FindOneAndUpdate(filter, update, result interface{}, args ...interface{}) error UpdateOne(filter interface{}, update interface{}, args ...interface{}) error UpdateMany(filter interface{}, update interface{}, args ...interface{}) (*UpdateManyResult, error) DeleteOne(filter interface{}, args ...interface{}) error DeleteMany(filter interface{}, args ...interface{}) (*DeleteManyResult, error) GetCollection() interface{} GetDb() interface{} GetRepoName() string SetLocale(code string) Aggregate(pipeline interface{}, result interface{}, args ...interface{}) error }
IBaseRepo
func NewMongoBaseRepo ¶ added in v0.8.0
func NewMongoBaseRepo(collection *mongo.Collection, baseRepoAudit ...IBaseRepoAudit) IBaseRepo
NewMongoBaseRepo, return base repo instance
type IBaseRepoAudit ¶ added in v1.0.0
type InsertManyResult ¶ added in v1.2.0
type InsertManyResult struct { FailedCount int64 InsertedIDs []interface{} }
Click to show internal directories.
Click to hide internal directories.