-
Notifications
You must be signed in to change notification settings - Fork 30
make api node style #5
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| var results = collection.where(query_data).find(); | ||
| if(callback){ | ||
| callback(results) | ||
| callback(null, results) | ||
| } | ||
| }); | ||
| }; | ||
|
|
@@ -32,7 +32,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| var results = collection.get(id); | ||
| if(callback){ | ||
| callback(results) | ||
| callback(null, results) | ||
| } | ||
| }); | ||
| }; | ||
|
|
@@ -45,7 +45,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| var results = collection.databaseData[me.db_name]; | ||
| if(callback){ | ||
| callback(results) | ||
| callback(null, results) | ||
| } | ||
| }); | ||
| }; | ||
|
|
@@ -60,7 +60,7 @@ RNDBModel.create_db = function(db){ | |
| // Add Data | ||
| collection.add(data_to_add, function(added_data_id){ | ||
| if(callback){ | ||
| callback(added_data_id) | ||
| callback(null, added_data_id) | ||
| } | ||
| RNDBModel.DBEvents.emit("all") | ||
| }); | ||
|
|
@@ -95,7 +95,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| collection.where(query_data).remove(function(data_removed){ | ||
| if(callback){ | ||
| callback(data_removed); | ||
| callback(null, data_removed); | ||
| } | ||
| }); | ||
| }); | ||
|
|
@@ -110,7 +110,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| collection.removeById(id, function(data_removed){ | ||
| if(callback){ | ||
| callback(data_removed); | ||
| callback(null, data_removed); | ||
| } | ||
| RNDBModel.DBEvents.emit("all") | ||
| }); | ||
|
|
@@ -125,7 +125,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warning (85% confidence) The 'erase_db' method calls 'collection.remove' which is likely intended to be 'collection.databaseData[me.db_name] = []' or a specific clear method. Calling 'remove' without a query might remove all items or behave unexpectedly depending on the underlying store implementation, and errors are not propagated to the callback. Posted by PR Code Reviewer — AI-powered code review |
||
| collection.remove(function(data_removed){ | ||
| if(callback){ | ||
| callback(data_removed); | ||
| callback(null, data_removed); | ||
| } | ||
| RNDBModel.DBEvents.emit("all") | ||
| }); | ||
|
|
@@ -141,7 +141,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| collection.where(query_data).update(replace_data, function(data){ | ||
| if(callback){ | ||
| callback(data); | ||
| callback(null, data); | ||
| } | ||
| RNDBModel.DBEvents.emit("all") | ||
| }); | ||
|
|
@@ -158,7 +158,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| collection.updateById(id, replace_data, function(data){ | ||
| if(callback){ | ||
| callback(data); | ||
| callback(null, data); | ||
| } | ||
| RNDBModel.DBEvents.emit("all") | ||
| }); | ||
|
|
@@ -174,7 +174,7 @@ RNDBModel.create_db = function(db){ | |
| ReactNativeStore.table(me.db_name).then(function(collection){ | ||
| collection.removeById(id, function(data_removed){ | ||
| if(callback){ | ||
| callback(data_removed); | ||
| callback(null, data_removed); | ||
| } | ||
| RNDBModel.DBEvents.emit("all") | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning (95% confidence)
Inconsistency: The 'add_all' method calls 'callback(added_data)' without the error-first argument 'null', unlike all other methods in the file. This breaks the Node.js convention established in this PR.
Posted by PR Code Reviewer — AI-powered code review