v0.0.134
This commit is contained in:
parent
c338d23070
commit
b02e1d2e85
@ -129,7 +129,16 @@ func (c *Coll[TData]) ReplaceOne(ctx context.Context, id any, value TData) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Coll[TData]) UpdateOne(ctx context.Context, id any, updateQuery any) error {
|
||||
func (c *Coll[TData]) UpdateOne(ctx context.Context, filterQuery any, updateQuery any) error {
|
||||
_, err := c.coll.UpdateOne(ctx, filterQuery, updateQuery)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Coll[TData]) UpdateOneByID(ctx context.Context, id any, updateQuery any) error {
|
||||
_, err := c.coll.UpdateOne(ctx, bson.M{"_id": id}, updateQuery)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -163,6 +172,15 @@ func (c *Coll[TData]) DeleteOne(ctx context.Context, id any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Coll[TData]) DeleteMany(ctx context.Context, filterQuery any) (*mongo.DeleteResult, error) {
|
||||
res, err := c.coll.DeleteMany(ctx, filterQuery)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *Coll[TData]) List(ctx context.Context, filter ct.Filter, pageSize *int, inTok ct.CursorToken) ([]TData, ct.CursorToken, error) {
|
||||
if inTok.Mode == ct.CTMEnd {
|
||||
return make([]TData, 0), ct.End(), nil
|
Loading…
Reference in New Issue
Block a user