Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create model registry and lookup by registered alias Toucan allows to query a model by either the model itself or the symbol of the model `(db/select 'User :id 1)`. This lookup will look at `models/root-namespace` for a model namespace. But this lookup will obviously fail if you define models in namespaces that do not follow this convention. For example multiple models in the same namespace cannot possibly work. This branch was added under the standard lookup so as not to be a breaking change. In either order there is the chance for ambiguity. Defining two models with the same name will never be well-defined. Under this change, it will always find the model defined by convention and never the one in a non-standard location. This ambiguity cannot actually be fixed since there is no disambiguating information in the query `(select 'Foo :id 1)`. * Guard against multiple namespaces. If there are multiple namespaces defining a model by the same name right now, it will always resolve to one at the conventional location. Before this change, no unconventional location models would ever be found by using the symbol. This explains why the lookup by model symbol is the second branch (so the current behavior, while unspecified before, continues in the same manner), and why we do not choose an item if multiple namespaces are registered (arbitrary model by set order, or last namespace read if we just keep one namespace).
- Loading branch information