-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[refactor] DAO improvements #346
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thibaultcha
force-pushed
the
refactor/dao
branch
from
June 19, 2015 15:14
9b98a4b
to
08b196b
Compare
Closed
thibaultcha
force-pushed
the
refactor/dao
branch
from
June 22, 2015 17:44
5e64f27
to
19bb9ef
Compare
thibaultcha
added
NEEDS REVIEW
and removed
pr/wip
A work in progress PR opened to receive feedback
labels
Jun 22, 2015
Needs reviewing, testing, a bit of squashing otherwise done feature-wise. |
thibaultcha
force-pushed
the
refactor/dao
branch
from
June 23, 2015 20:02
0a22962
to
ec7941c
Compare
thibaultcha
added
pr/ready (but hold merge)
No more concerns, but do not merge yet (probably a conflict of interest with another PR or release)
and removed
NEEDS REVIEW
labels
Jun 23, 2015
- New property on a schema field: `dao_insert_value` to specify this value will be set by the DAO. Any previously set value will be overriden. Ignored on update operation. - This property calls a function expected as being part of the `options` table given to `validate`. This function will take the field definition as a parameter. - No more constants for schema types for several reasons: lua types aren't constants, so string, number, or id are now all on the same level: plain strings. It should be considered a **litteral**. It's also painful to import constants everywhere, especially in plugins. Not much benefits from making those constants. Partially fixes #103
Primary key and indexed columns are now stored in the schema and used by the query builder to build valid WHERE fragment for queries.
- cassandra_spec.lua doesn't have keyauth and ratelimiting tests too. Those are now living in `plugins/` - cassandra_spec.lua now focuses on the Base DAO behaviour, instead of the entities schemas and their validation (that is `entities_schema_spec.lua`'s role) - DAOs `_queries` is renamed `queries` - `query_builder.lua` returns a boolean indicating whether or not ALLOW FILTERING was added to the query
- Factory checks if the DB is accessible even if there is no queries to prepare - rename `cassandra_spec` to `base_dao_spec`
By doing a PUT request to the API, one can now omit a field. If that field is omitted and if the schema still validates, the value will be set to null in the DB.
thibaultcha
force-pushed
the
refactor/dao
branch
from
June 23, 2015 20:13
ec7941c
to
9f6efab
Compare
thibaultcha
added a commit
that referenced
this pull request
Jun 23, 2015
[refactor] DAO improvements
ctranxuan
pushed a commit
to streamdataio/kong
that referenced
this pull request
Aug 25, 2015
[refactor] DAO improvements Former-commit-id: 817748a13550493e7ec0a2dfeb8aa605cd99ef14
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
pr/ready (but hold merge)
No more concerns, but do not merge yet (probably a conflict of interest with another PR or release)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #103: DAO assuming
id
andcreated_at
were part of every entity and removing written queries for CRUD operations for simpler plugins DAO creation (#312).Changes
query_builder.lua
.dao_insert
specifies a field is generated by the DAO itself. For ex, if using Cassandra, it'll be a uuid, or it can be anint
for another DB.find_one()
renamedfind_by_primary_key()
which still takes a table and that table should contain every key part of the entity's primary key.fields
table and introducingprimary_key
,indexes
andclustering_key
(the latest only for Cassandra) that are useful for thequery_builder
to know when toALLOW FILTERING
or not.queryable = true
on a schema field means to the Cassandra DAO that this field is indexed by Cassandra.on_insert()
to be executed when inserting an entity.Todo