forked from brianc/node-sql
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support AS OF queries for CockroachDB
- Loading branch information
1 parent
bd5434a
commit 22128b0
Showing
9 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Node } from './node.js'; | ||
|
||
export class AsOfNode extends Node { | ||
constructor() { | ||
super('AS OF'); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as Harness from './support.js'; | ||
import { Sql } from '../../dist/lib.js'; | ||
const post = Harness.definePostTable(); | ||
const user = Harness.defineUserTable(); | ||
const instance = new Sql('postgres'); | ||
|
||
Harness.test({ | ||
query: user | ||
.select(user.star()) | ||
.from(user) | ||
.asOf(instance.functions.FOLLOWER_READ_TIMESTAMP()), | ||
pg: { | ||
text: 'SELECT "user".* FROM "user" AS OF SYSTEM TIME FOLLOWER_READ_TIMESTAMP()', | ||
string: 'SELECT "user".* FROM "user" AS OF SYSTEM TIME FOLLOWER_READ_TIMESTAMP()' | ||
}, | ||
oracle: { | ||
text: 'SELECT "user".* FROM "user" AS OF TIMESTAMP FOLLOWER_READ_TIMESTAMP()', | ||
string: 'SELECT "user".* FROM "user" AS OF TIMESTAMP FOLLOWER_READ_TIMESTAMP()' | ||
} | ||
}); | ||
|
||
Harness.test({ | ||
query: user.select(user.star()).from([user, post]).asOf('\'-10s\''), | ||
pg: { | ||
text: 'SELECT "user".* FROM "user" , "post" AS OF SYSTEM TIME \'-10s\'', | ||
string: 'SELECT "user".* FROM "user" , "post" AS OF SYSTEM TIME \'-10s\'' | ||
}, | ||
oracle: { | ||
text: 'SELECT "user".* FROM "user" , "post" AS OF TIMESTAMP \'-10s\'', | ||
string: 'SELECT "user".* FROM "user" , "post" AS OF TIMESTAMP \'-10s\'' | ||
} | ||
}); |