샘플
bun 1.3.14: Use SQLite from Bun with the built-in bun:sqlite module, with no npm package and no native build
검증된 샘플 — npm bun 1.3.14: Use SQLite from Bun with the built-in bun:sqlite module, with no npm package and no native build. bun 1 · linux alpine/x64 …
sha256:6aa79cb39a2ca09b9f9be36d65c6b5ee6b822c96560fc9dee9d80d1840830d1c
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 2
선언된 환경
bun 1 linux x64 bun 1 javascript bun
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| bun 1 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1 |
2026-08-14 |
| bun 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · npm@1 |
2026-08-18 |
케이스
HOW- 목표
- Use SQLite from Bun with the built-in bun:sqlite module, with no npm package and no native build
- 패키지
- 심벌
-
- bun:sqlite.Database
- Database.query
- Database.prepare
- Statement.get
- Statement.all
- Statement.run
- Statement.safeIntegers
- SQLiteError
- 환경
- bun 1
- 생성일
- 2026-08-14T12:07:16Z
컨트랙트
- open ':memory:' and assert each connection is a private database
- assert new Database(path, {}) raises SQLITE_MISUSE while new Database(path) works, because an options object resets the open flags, and that only a true access mode or a strict/safeIntegers key restores one, so { create: false } raises the same way
- assert .get() returns a plain row object, and null rather than undefined when nothing matches
- assert .all() returns an array, and an empty array when nothing matches
- assert .run() returns changes and lastInsertRowid and never rows, and that lastInsertRowid is the connection's last insert rather than this statement's
- assert ? binding is counted, so a wrong number of values raises
- assert $name binding needs the sigil on the key by default, where a bare key silently binds NULL
- assert strict: true inverts that, binding bare keys and raising Missing parameter for the $ key
- assert binding is real escaping by storing a value that closes a quote and drops the table
- assert db.query() returns one cached statement per SQL string while db.prepare() returns a new one, so safeIntegers set on a query() statement leaks to later callers
- assert an integer past Number.MAX_SAFE_INTEGER is stored losslessly but read back rounded, and is exact only with safeIntegers, as a BigInt
- assert safeIntegers as a constructor option makes every read on the connection exact, including lastInsertRowid, while changes stays a number, and that there is no Database-level safeIntegers toggle
- assert a unique constraint raises SQLiteError carrying SQLite's extended result code
- assert bun:sqlite is a builtin of the Bun runtime rather than an npm package: the Bun global is present, node:sqlite is not, and the project resolves no dependencies
파일
- csx.json
- package.json
- src/ledger.mjs
- test/contract.mjs