-
Notifications
You must be signed in to change notification settings - Fork 18
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
Redesign metadata and Query Builder #31
Commits on Mar 28, 2017
-
Use underscore functions for Trans metadata
When a module uses `Trans`, two underscore functions will be added to provide the necessary metadata for the `Trans.QueryBuilder` and `Trans.Translator` functions. This underscore functions are: - `__trans__(:container)`, which returns the name of the translation container field. - `__trans__(:fields)`, which returns a list of the translatable fields.
Configuration menu - View commit details
-
Copy full SHA for 2ee5a22 - Browse repository at this point
Copy the full SHA 2ee5a22View commit details
Commits on Mar 29, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 511b4ee - Browse repository at this point
Copy the full SHA 511b4eeView commit details
Commits on Mar 30, 2017
-
Remove translation container customization
The translation container customization allowed users to declare an alternative field (the default was `:translations`) as the field that contained the translations for the schema. This customization has been sacrificed to ease the rewrite of the QueryBuilder module. Now, Trans will always look in the `:translations` field and there is no way to customize it.
Configuration menu - View commit details
-
Copy full SHA for f0c1d0c - Browse repository at this point
Copy the full SHA f0c1d0cView commit details -
All the functions of the `Trans.QueryBuilder` module have been removed and replaced with the macro `translated/2`. This macro generates an SQL Fragment and can be directly used from inside an `Ecto.Query`. This removes the necessity of building the query before calling the `Trans.QueryBuilder` functions and integrates seamelessly with `Ecto.Query` provided functions for comparisons, etc. This also permits adding conditions on joined schemas.
Configuration menu - View commit details
-
Copy full SHA for b68fb7f - Browse repository at this point
Copy the full SHA b68fb7fView commit details -
Update QueryBuilder tests with new query syntax
The QueryBuilder tests have been updated to use the newly introduced `translated` macro.
Configuration menu - View commit details
-
Copy full SHA for a682ec1 - Browse repository at this point
Copy the full SHA a682ec1View commit details
Commits on Mar 31, 2017
-
The translator module does not require to be passed the name of the translation container field. The test have also been updated to reflect this change.
Configuration menu - View commit details
-
Copy full SHA for 69285e0 - Browse repository at this point
Copy the full SHA 69285e0View commit details -
Fix PostgreSQL JSONB operators precedence errors
In PostgreSQL 9.4 [1] the operators had different precedence rules than in PostgreSQL 9.5 or higher [2] (take a look at "any other operator" in the table. This differences caused errors when triggering a query that contained something similar to `where a->b is not null`, which 9.4 would interpret as `where a->(b is not null)` and 9.5 or higher would interpret as `where (a->b) is not null`. This commits adds parentheses around the JSONB accesses to avoid this kind of problems by stating the desired preference explicitly. [1] https://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html [2] https://www.postgresql.org/docs/9.5/static/sql-syntax-lexical.html
Configuration menu - View commit details
-
Copy full SHA for 1c9a8e3 - Browse repository at this point
Copy the full SHA 1c9a8e3View commit details -
Configuration menu - View commit details
-
Copy full SHA for e8d0d20 - Browse repository at this point
Copy the full SHA e8d0d20View commit details
Commits on Apr 1, 2017
-
Options provided when using `Trans` are now stored into a module attribute.
Configuration menu - View commit details
-
Copy full SHA for bbb905e - Browse repository at this point
Copy the full SHA bbb905eView commit details -
Validate translatable fields during compilation
`Trans` will validate the fields declared as translatable and raise an error during compilation time if they are not declared in the module's struct or schema definition.
Configuration menu - View commit details
-
Copy full SHA for 92d305b - Browse repository at this point
Copy the full SHA 92d305bView commit details -
Validate translated field in Trans.Translator
Trans.Translator now validates that whether the field is translatable and provides a useful error message instead of the default `KeyError`. Docs have been updated and typespecs added.
Configuration menu - View commit details
-
Copy full SHA for 4b0e5fd - Browse repository at this point
Copy the full SHA 4b0e5fdView commit details
Commits on Apr 2, 2017
-
Check whether a field is translatable or not
The function `Trans.translatable?/2` checks whether a field is translatable or not.
Configuration menu - View commit details
-
Copy full SHA for d02711d - Browse repository at this point
Copy the full SHA d02711dView commit details -
Configuration menu - View commit details
-
Copy full SHA for c1c333f - Browse repository at this point
Copy the full SHA c1c333fView commit details -
Validate translated conditions in compile time
The macro `Trans.QueryBuilder.translated/3` now validates the translated fields before the macro expansion step. We will receive an error in compilation time when adding conditions on untranslatable fields.
Configuration menu - View commit details
-
Copy full SHA for cbb6ba1 - Browse repository at this point
Copy the full SHA cbb6ba1View commit details -
Configuration menu - View commit details
-
Copy full SHA for e51689c - Browse repository at this point
Copy the full SHA e51689cView commit details