Merged
Conversation
Contributor
Author
|
Ok, this is sooo nearly done. I've just copied the tests over from insert to make sure it behaves exactly the same. They're all passing apart from tests that e.g: entry.insert(entry.key).add(entry.select()).toString()
// INSERT INTO "keyv" ("key") SELECT "keyv".* FROM "keyv"
entry.replace(entry.key).add(entry.select()).toString()
// REPLACE INTO "keyv" ("key") (SELECT "keyv".* FROM "keyv")I'm not quite sure why it's not the same for replace, is anyone able to point me in the right direction? |
Contributor
Author
|
Fixed 🎉 |
Owner
|
Nice! Merging & pushing new minor version right now. Thanks a bunch! |
caseyWebb
pushed a commit
to caseyWebb/keyv
that referenced
this pull request
Oct 10, 2019
jaredwray
pushed a commit
to jaredwray/keyv
that referenced
this pull request
Nov 21, 2021
jaredwray
added a commit
to jaredwray/keyv
that referenced
this pull request
Nov 21, 2021
* Initial commit * docs(readme): add Greenkeeper badge * Setup entry schema * Use key as primary key * Ensure keys are unique and indexable * Disable timestamps * Add get/set/delete methods * Add clear method * Wait for connection before running queries * Return Boolean for delete method * clear method always resolves to undefined * get method returns undefined on nonexistent keys * Disable logging by default * 0.1.0 * Make invalid connection string more clear * Explicitly use memory for tests * KeyvSQLite => KeyvSqlite * Respect table name * Don't run tests in memory * Accept connection string as contructor argument * Make sure clear only clears current namespace * 0.2.0 * Remove Greenkeeper badge * Test options have expected defaults * Extract keyv-sequelize from keyv-sqlite * Update metadata/readme for Sequelize * Test against SQLite * Set defaults for logging/table * 0.1.0 * Test connection errors are emitted * Extract keyv-sql from keyv-sequelize * Add set method * Add get method * Add delete method * Add clear method * 0.1.0 * Test against SQLite * Ensure keys are unique and indexed as primary keys * Make sure set can update or insert * Use our fork of sql until REPLACE support is merged brianc/node-sql#368 * Keep XO happy * Move back to sql Our changes were merged 🎉 * 0.2.0 * Refactor query into method * Use large busyTimeout with tests Stops 'SQLITE_BUSY: database is locked' errors from creating loads of connections * 0.2.1 * Wrap upserts in if/else so we only run the correct functions Otherwise node-sql will throw errors when building a query that Postgres can't handle * 0.2.2 * Expose opts.dialect rather than sql.dialectName * 0.2.3 * Update to requirable * Lock dependency versions * 0.2.4 * List keyv-postgres and keyv-mysql * 1.0.0 * Fix old Sequelize wording * 1.0.1 * Add keyv logo to header * 1.0.2 * Update sql to the latest version 🚀 (#3) * 1.0.3 * Scope to @keyv * 1.0.4 * Update readme for new scope * 1.0.5 * Update ava to the latest version 🚀 (#7) * Fix JSON quotes in MySQL * 1.0.6 * Allow setting custom VARCHAR key size * Ensure opts.keySize is a number * Test keySize option * 1.1.0 * Add .npmignore * 1.1.1 * Fix bad URLs in package.json (sqlite -> sql) (#10) * 1.1.2 * Update coveralls to the latest version 🚀 (#11) * Update ava to the latest version 🚀 (#12) * Update ava to the latest version 🚀 (#13) * Update ava to the latest version 🚀 (#14) * Update sqlite3 to the latest version 🚀 (#16) * upgrading sqlite3 to version 5.0.2 * creating build yaml for github actions * removing travis ci from build process * updating workflows naming * upgrading pify to version 5.0.0 * updating license to include authors * updating with build status badge * upgrading xo to version 0.45.0 * fixing standard xo issues * fixing standard xo issues * upgrading nyc to version 15.1.0 * upgrading ava to version 3.15.0 * version bump to 1.1.3 * updating authors and github links to jaredwray * updating to include coverage for sql * adding in clean variables and removing rimraf * removing rimraf * removing sqlite * removing sqlite file * moving sql to mono * adding in clean up of sqlite test db * removing from main keyv since importing to mono * validating value coming back Co-authored-by: Luke Childs <[email protected]> Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com> Co-authored-by: MySidesTheyAreGone <[email protected]>
SuperButterfly
added a commit
to SuperButterfly/keyv
that referenced
this pull request
Sep 18, 2022
* Initial commit * docs(readme): add Greenkeeper badge * Setup entry schema * Use key as primary key * Ensure keys are unique and indexable * Disable timestamps * Add get/set/delete methods * Add clear method * Wait for connection before running queries * Return Boolean for delete method * clear method always resolves to undefined * get method returns undefined on nonexistent keys * Disable logging by default * 0.1.0 * Make invalid connection string more clear * Explicitly use memory for tests * KeyvSQLite => KeyvSqlite * Respect table name * Don't run tests in memory * Accept connection string as contructor argument * Make sure clear only clears current namespace * 0.2.0 * Remove Greenkeeper badge * Test options have expected defaults * Extract keyv-sequelize from keyv-sqlite * Update metadata/readme for Sequelize * Test against SQLite * Set defaults for logging/table * 0.1.0 * Test connection errors are emitted * Extract keyv-sql from keyv-sequelize * Add set method * Add get method * Add delete method * Add clear method * 0.1.0 * Test against SQLite * Ensure keys are unique and indexed as primary keys * Make sure set can update or insert * Use our fork of sql until REPLACE support is merged brianc/node-sql#368 * Keep XO happy * Move back to sql Our changes were merged 🎉 * 0.2.0 * Refactor query into method * Use large busyTimeout with tests Stops 'SQLITE_BUSY: database is locked' errors from creating loads of connections * 0.2.1 * Wrap upserts in if/else so we only run the correct functions Otherwise node-sql will throw errors when building a query that Postgres can't handle * 0.2.2 * Expose opts.dialect rather than sql.dialectName * 0.2.3 * Update to requirable * Lock dependency versions * 0.2.4 * List keyv-postgres and keyv-mysql * 1.0.0 * Fix old Sequelize wording * 1.0.1 * Add keyv logo to header * 1.0.2 * Update sql to the latest version 🚀 (#3) * 1.0.3 * Scope to @keyv * 1.0.4 * Update readme for new scope * 1.0.5 * Update ava to the latest version 🚀 (#7) * Fix JSON quotes in MySQL * 1.0.6 * Allow setting custom VARCHAR key size * Ensure opts.keySize is a number * Test keySize option * 1.1.0 * Add .npmignore * 1.1.1 * Fix bad URLs in package.json (sqlite -> sql) (#10) * 1.1.2 * Update coveralls to the latest version 🚀 (#11) * Update ava to the latest version 🚀 (#12) * Update ava to the latest version 🚀 (#13) * Update ava to the latest version 🚀 (#14) * Update sqlite3 to the latest version 🚀 (#16) * upgrading sqlite3 to version 5.0.2 * creating build yaml for github actions * removing travis ci from build process * updating workflows naming * upgrading pify to version 5.0.0 * updating license to include authors * updating with build status badge * upgrading xo to version 0.45.0 * fixing standard xo issues * fixing standard xo issues * upgrading nyc to version 15.1.0 * upgrading ava to version 3.15.0 * version bump to 1.1.3 * updating authors and github links to jaredwray * updating to include coverage for sql * adding in clean variables and removing rimraf * removing rimraf * removing sqlite * removing sqlite file * moving sql to mono * adding in clean up of sqlite test db * removing from main keyv since importing to mono * validating value coming back Co-authored-by: Luke Childs <[email protected]> Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com> Co-authored-by: MySidesTheyAreGone <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #367
Ok, so from the MySQL docs:
https://dev.mysql.com/doc/refman/5.7/en/replace.html
So I've pretty much just copy/pasted all the
INSERTcode and it's working:REPLACEis a MySQL extension but is also supported by SQLite. I've implemented it in the Postgres dialect so both MySQL and SQLite inherit it to test it works. I'll fix it so it throws if not on MySQL or SQLite dialect.Also need to add tests.