Typescript-specific.

Interface that may be used to add custom type definitions to the set of values allowed by FieldValue type. For example, when using 3rd party number library (see DBNumberConfig) you can use this interface to include the 3rd party number type as an allowed FieldValue in order to avoid compilation errors. For this, define dbNumber property as shown in the example below.

Use module agumentation to add custom type definitions via this interface as shown in the example. Note that it should be sufficient to augment oracle-nosql module only once for your application project.

Example

Using CustomFieldTypes interface for 3rd party number support.

import type { NoSQLClient } from "oracle-nosqldb";
import type { Decimal } from "decimal.js";

declare module "oracle-nosqldb" {
interface CustomFieldTypes {
dbNumber: Decimal;
}
}

async function test(client: NoSQLClient): Promise<void> {
.....
// Ok to use Decimal instance as field value
const res = await client.put("my_table", {
partNo: 1000,
price: new Decimal(123.45)
});
.....
}

See

Hierarchy

  • CustomFieldTypes

Generated using TypeDoc