Add namespacing for users

This commit is contained in:
Bel LaPointe
2020-07-22 22:20:06 -06:00
parent 1a6973b02c
commit 660cd64262
5 changed files with 45 additions and 37 deletions

View File

@@ -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)
}