File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -339,6 +339,7 @@ class Statement {
339339}
340340
341341const cachedCount = Symbol . for ( "Bun.Database.cache.count" ) ;
342+ const sqliteTypeSymbol = Symbol . for ( "sqlite-type" ) ;
342343
343344class Database implements SqliteTypes . Database {
344345 constructor (
@@ -437,6 +438,10 @@ class Database implements SqliteTypes.Database {
437438 return SQL . isInTransaction ( this . #handle) ;
438439 }
439440
441+ get [ sqliteTypeSymbol ] ( ) {
442+ return "bun:sqlite" ;
443+ }
444+
440445 static open ( filename , options ) {
441446 return new Database ( filename , options ) ;
442447 }
Original file line number Diff line number Diff line change @@ -8,6 +8,18 @@ import path from "path";
88
99const tmpbase = tmpdir ( ) + path . sep ;
1010
11+ describe ( "sqlite-type symbol" , ( ) => {
12+ it ( "should have the sqlite-type symbol with value 'bun:sqlite'" , ( ) => {
13+ const db = new Database ( ":memory:" ) ;
14+ const sqliteTypeSymbol = Symbol . for ( "sqlite-type" ) ;
15+
16+ expect ( sqliteTypeSymbol in db ) . toBe ( true ) ;
17+ expect ( db [ sqliteTypeSymbol ] ) . toBe ( "bun:sqlite" ) ;
18+
19+ db . close ( ) ;
20+ } ) ;
21+ } ) ;
22+
1123describe ( "as" , ( ) => {
1224 it ( "should return an implementation of the class" , ( ) => {
1325 const db = new Database ( ":memory:" ) ;
You can’t perform that action at this time.
0 commit comments