Skip to content

Commit 5dd912a

Browse files
authored
Fix typehint for Timeuuid (#255)
fixes #235
1 parent c29833e commit 5dd912a

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

lib/types/type-guessing.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ function guessType(value) {
4444
code = typeValues.varint;
4545
} else if (value instanceof BigDecimal) {
4646
code = typeValues.decimal;
47+
} else if (value instanceof types.TimeUuid) {
48+
code = typeValues.timeuuid;
4749
} else if (value instanceof types.Uuid) {
4850
code = typeValues.uuid;
4951
} else if (value instanceof types.InetAddress) {

test/integration/supported/client-execute-tests.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ describe("Client @SERVER_API", function () {
228228
);
229229
}); */
230230

231-
// Type guessing doesn't allow to distinguish between UUID and TimeUUID
232-
// TODO: Fix this test, and then remove reduced version below
233-
/* vit("2.0", "should guess known types", function (done) {
231+
vit("2.0", "should guess known types", function (done) {
234232
const client = setupInfo.client;
235233
const columns =
236234
"id, timeuuid_sample, text_sample, double_sample, timestamp_sample, blob_sample, list_sample";
@@ -246,23 +244,6 @@ describe("Client @SERVER_API", function () {
246244
];
247245
// no hint
248246
insertSelectTest(client, table, columns, values, null, done);
249-
}); */
250-
251-
vit("2.0", "should guess known types -- reduced", function (done) {
252-
const client = setupInfo.client;
253-
const columns =
254-
"id, text_sample, double_sample, timestamp_sample, blob_sample, list_sample";
255-
// a precision a float32 can represent
256-
const values = [
257-
types.Uuid.random(),
258-
"text sample 1",
259-
133,
260-
new Date(121212211),
261-
utils.allocBufferUnsafe(100),
262-
["one", "two"],
263-
];
264-
// no hint
265-
insertSelectTest(client, table, columns, values, null, done);
266247
});
267248

268249
vit(

test/unit/type-guessing-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe("Encoder.guessDataType()", function () {
5454
);
5555
assertGuessed(
5656
types.TimeUuid.now(),
57-
rust.CqlType.Uuid,
57+
rust.CqlType.Timeuuid,
5858
"Guess type for a TimeUuid value failed",
5959
);
6060
assertGuessed(

0 commit comments

Comments
 (0)