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

The return value of Diplomat.Entity.insert/1 #35

Open
s417-lama opened this issue Apr 13, 2018 · 1 comment
Open

The return value of Diplomat.Entity.insert/1 #35

s417-lama opened this issue Apr 13, 2018 · 1 comment

Comments

@s417-lama
Copy link

According to Hex, Diplomat.Entity.insert/1's spec is:

insert([t()] | t()) :: {:ok, Diplomat.Key.t()} | Diplomat.Client.error()

However, it seems that it returns [Diplomat.Key.t()] when success.
I think it should return {:ok, Diplomat.Key.t()}.

@leozilla
Copy link
Contributor

I think it makes more sense to return a list. Because in the case the elment(s) is/are found they are present in the list and otherwise the list is empty.
I would vote for fixing the type spec to insert([t()] | t()) :: [Diplomat.Key.t()] | Diplomat.Client.error()

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

No branches or pull requests

2 participants