Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespacing #12

Merged
merged 2 commits into from
Jun 6, 2017
Merged

Namespacing #12

merged 2 commits into from
Jun 6, 2017

Conversation

connor4312
Copy link
Member

Described pretty well, with an example, in the Namespace class:

Namespace is the class on which CRUD operations can be invoked. The default
namespace is the empty string, "". You can create nested namespaces by
calling the namespace(prefix) method.

For example, if the current namespace is the default "" and you call
namespace('user1/'), all operations on that new namespace will be
automatically prefixed with user1/:

const client = new Etcd3();
const ns = client.namespace('user1/');

await ns.put('foo').value('bar'); // sets the key `user1/foo` to `bar`
await ns.delete().all(); // deletes all keys with the prefix `user1/`

Namespacing is particularly useful to avoid clashing between multiple
applications and when using Etcd's access control.

}

// TS doesn't seem to like the spread operator on generics, so O.A it is.
return Object.assign({}, req, {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use destructuring here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in person, destructuring doesn't type well with generics

@connor4312 connor4312 merged commit b1b5a45 into master Jun 6, 2017
@connor4312 connor4312 deleted the namespacing branch June 6, 2017 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants