unjs/db0

Error in docs examples

Closed this issue · 2 comments

Describe the change

version: db0 v0.1.3

  1. In many examples, sql which does not exist is imported from 'db0'
  2. bindingName in the example of PostgreSQL does not exist in the option
- import { createDatabase, sql } from "db0";
+ import { createDatabase } from "db0";
import postgresql from "db0/connectors/postgresql";

const db = createDatabase(
  postgresql({
-    bindingName: "DB",
  }),
);
  1. drizzle can only be imported from db0/integrations/drizzle/index instead of db0/integrations/drizzle stated in the docs, maybe an issue of exports in package.json (moduleResolution of my project is bundler which is the default in nuxt)?
import { createDatabase } from "db0";
import sqlite from "db0/connectors/better-sqlite3";
- import { drizzle } from "db0/integrations/drizzle";
+ import { drizzle } from "db0/integrations/drizzle/index";
import { sqliteTable, text, numeric } from "drizzle-orm/sqlite-core";

// Initialize DB instance
// You can use any other available connector
const db = createDatabase(sqlite({}));

URLs

https://db0.unjs.io/connectors/bun
https://db0.unjs.io/connectors/cloudflare
https://db0.unjs.io/connectors/libsql
https://db0.unjs.io/connectors/sqlite
https://db0.unjs.io/connectors/vercel
https://db0.unjs.io/connectors/postgresql
https://db0.unjs.io/integrations/drizzle

Additional information

  • Would you be willing to help?

Bump, still out of date.

pi0 commented

thanks for report!