Add namespacing for users
This commit is contained in:
@@ -19,9 +19,9 @@ func NewGraph() Graph {
|
||||
}
|
||||
}
|
||||
|
||||
func (g Graph) List(ctx context.Context, from ...string) ([]entity.One, error) {
|
||||
func (g Graph) List(ctx context.Context, namespace string, from ...string) ([]entity.One, error) {
|
||||
filter := operator.NewFilterIn("_id", from)
|
||||
ch, err := g.mongo.Find(ctx, filter)
|
||||
ch, err := g.mongo.Find(ctx, namespace, filter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -36,14 +36,14 @@ func (g Graph) List(ctx context.Context, from ...string) ([]entity.One, error) {
|
||||
return ones, nil
|
||||
}
|
||||
|
||||
func (g Graph) Insert(ctx context.Context, one entity.One) error {
|
||||
return g.mongo.Insert(ctx, one)
|
||||
func (g Graph) Insert(ctx context.Context, namespace string, one entity.One) error {
|
||||
return g.mongo.Insert(ctx, namespace, one)
|
||||
}
|
||||
|
||||
func (g Graph) Update(ctx context.Context, one entity.One, modify interface{}) error {
|
||||
return g.mongo.Update(ctx, one, modify)
|
||||
func (g Graph) Update(ctx context.Context, namespace string, one entity.One, modify interface{}) error {
|
||||
return g.mongo.Update(ctx, namespace, one, modify)
|
||||
}
|
||||
|
||||
func (g Graph) Delete(ctx context.Context, filter interface{}) error {
|
||||
return g.mongo.Delete(ctx, filter)
|
||||
func (g Graph) Delete(ctx context.Context, namespace string, filter interface{}) error {
|
||||
return g.mongo.Delete(ctx, namespace, filter)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user