Commit 3827237
committed
Clarify that index names can be a string or an atom
Definitely both work, I've tried it out to make sure. Not having
it specified caused some confusion in my team and I think it
can help to specify this.
I did change the time spec, as I'm rather sure it also ends up
in there as a string.
I'm a bit surprised/confused that the docs default to atom usage
as as best I can tell the index is used for instance here:
(Postgres connection)
```elixir
queries = [
[
"CREATE ",
if_do(index.unique, "UNIQUE "),
"INDEX ",
if_do(index.concurrently, "CONCURRENTLY "),
if_do(command == :create_if_not_exists, "IF NOT EXISTS "),
quote_name(index.name),
" ON ",
more stuff
```
which ends up converting the atom back to a string:
```elixir
defp quote_name(nil, name), do: quote_name(name)
defp quote_name(prefix, name), do: [quote_name(prefix), ?., quote_name(name)]
defp quote_name(name) when is_atom(name) do
quote_name(Atom.to_string(name))
end
more stuff
```
But yeah, I don't know as well - I was thinking maybe to use
name as a string in the docs at least once to show it's possible
but maybe that breaks with a desire for uniformity.1 parent df6732a commit 3827237
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
| 782 | + | |
| 783 | + | |
783 | 784 | | |
784 | 785 | | |
785 | 786 | | |
| |||
0 commit comments