Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bun-types

Package Overview
Dependencies
Maintainers
3
Versions
688
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bun-types - npm Package Compare versions

Comparing version 1.1.14-canary.20240616T140455 to 1.1.14-canary.20240617T140525

2

package.json
{
"version": "1.1.14-canary.20240616T140455",
"version": "1.1.14-canary.20240617T140525",
"name": "bun-types",

@@ -4,0 +4,0 @@ "license": "MIT",

@@ -85,2 +85,36 @@ /**

readwrite?: boolean;
/**
* When set to `true`, integers are returned as `bigint` types.
*
* When set to `false`, integers are returned as `number` types and truncated to 52 bits.
*
* @default false
* @since v1.1.14
*/
safeInteger?: boolean;
/**
* When set to `false` or `undefined`:
* - Queries missing bound parameters will NOT throw an error
* - Bound named parameters in JavaScript need to exactly match the SQL query.
*
* @example
* ```ts
* const db = new Database(":memory:", { strict: false });
* db.run("INSERT INTO foo (name) VALUES ($name)", { $name: "foo" });
* ```
*
* When set to `true`:
* - Queries missing bound parameters will throw an error
* - Bound named parameters in JavaScript no longer need to be `$`, `:`, or `@`. The SQL query will remain prefixed.
*
* @example
* ```ts
* const db = new Database(":memory:", { strict: true });
* db.run("INSERT INTO foo (name) VALUES ($name)", { name: "foo" });
* ```
* @since v1.1.14
*/
strict?: boolean;
},

@@ -172,3 +206,3 @@ );

...bindings: ParamsType[]
): void;
): Changes;
/**

@@ -180,3 +214,3 @@ This is an alias of {@link Database.prototype.run}

...bindings: ParamsType[]
): void;
): Changes;

@@ -601,3 +635,3 @@ /**

*/
run(...params: ParamsType): void;
run(...params: ParamsType): Changes;

@@ -710,2 +744,40 @@ /**

/**
*
* Make {@link get} and {@link all} return an instance of the provided
* `Class` instead of the default `Object`.
*
* @param Class A class to use
* @returns The same statement instance, modified to return an instance of `Class`
*
* This lets you attach methods, getters, and setters to the returned
* objects.
*
* For performance reasons, constructors for classes are not called, which means
* initializers will not be called and private fields will not be
* accessible.
*
* @example
*
* ## Custom class
* ```ts
* class User {
* rawBirthdate: string;
* get birthdate() {
* return new Date(this.rawBirthdate);
* }
* }
*
* const db = new Database(":memory:");
* db.exec("CREATE TABLE users (id INTEGER PRIMARY KEY, rawBirthdate TEXT)");
* db.run("INSERT INTO users (rawBirthdate) VALUES ('1995-12-19')");
* const query = db.query("SELECT * FROM users");
* query.as(User);
* const user = query.get();
* console.log(user.birthdate);
* // => Date(1995, 11, 19)
* ```
*/
as<T = unknown>(Class: new (...args: any[]) => T): Statement<T, ParamsType>;
/**
* Native object representing the underlying `sqlite3_stmt`

@@ -1073,2 +1145,19 @@ *

}
/**
* An object representing the changes made to the database since the last `run` or `exec` call.
*
* @since Bun v1.1.14
*/
interface Changes {
/**
* The number of rows changed by the last `run` or `exec` call.
*/
changes: number;
/**
* If `safeIntegers` is `true`, this is a `bigint`. Otherwise, it is a `number`.
*/
lastInsertRowid: number | bigint;
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc