{"id":13485164,"url":"https://github.com/eveningkid/denodb","last_synced_at":"2025-05-15T12:03:42.999Z","repository":{"id":37049692,"uuid":"264673536","full_name":"eveningkid/denodb","owner":"eveningkid","description":"MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno","archived":false,"fork":false,"pushed_at":"2023-10-28T10:30:08.000Z","size":620,"stargazers_count":1931,"open_issues_count":106,"forks_count":131,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-14T19:59:33.627Z","etag":null,"topics":["database","deno","mariadb","mongo","mongodb","mysql","orm","postgresql","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"https://eveningkid.com/denodb-docs","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eveningkid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-17T13:31:05.000Z","updated_at":"2025-03-25T13:01:47.000Z","dependencies_parsed_at":"2024-01-05T21:00:09.285Z","dependency_job_id":"3f312a25-6ed1-4fa2-b470-da608e6fb0da","html_url":"https://github.com/eveningkid/denodb","commit_stats":{"total_commits":189,"total_committers":28,"mean_commits":6.75,"dds":0.544973544973545,"last_synced_commit":"741f1dd89c28f0ed7944a208f76590aeb213ab33"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveningkid%2Fdenodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveningkid%2Fdenodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveningkid%2Fdenodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eveningkid%2Fdenodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eveningkid","download_url":"https://codeload.github.com/eveningkid/denodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","deno","mariadb","mongo","mongodb","mysql","orm","postgresql","sqlite","sqlite3"],"created_at":"2024-07-31T17:01:48.531Z","updated_at":"2025-05-15T12:03:37.985Z","avatar_url":"https://github.com/eveningkid.png","language":"TypeScript","readme":"\u003cimg src=\"./design/logo.png\" height=\"150\" /\u003e\n\n# DenoDB\n\n**⛔️ This project is not actively maintained: expect issues, and delays in reviews**\n\n- 🗣 Supports PostgreSQL, MySQL, MariaDB, SQLite and MongoDB\n- 🔥 Simple, typed API\n- 🦕 Deno-ready\n- [Read the documentation](https://eveningkid.github.io/denodb-docs)\n\n```typescript\nimport { DataTypes, Database, Model, PostgresConnector } from 'https://deno.land/x/denodb/mod.ts';\n\nconst connection = new PostgresConnector({\n  host: '...',\n  username: 'user',\n  password: 'password',\n  database: 'airlines',\n});\n\nconst db = new Database(connection);\n\nclass Flight extends Model {\n  static table = 'flights';\n  static timestamps = true;\n\n  static fields = {\n    id: { primaryKey: true, autoIncrement: true },\n    departure: DataTypes.STRING,\n    destination: DataTypes.STRING,\n    flightDuration: DataTypes.FLOAT,\n  };\n\n  static defaults = {\n    flightDuration: 2.5,\n  };\n}\n\ndb.link([Flight]);\n\nawait db.sync({ drop: true });\n\nawait Flight.create({\n  departure: 'Paris',\n  destination: 'Tokyo',\n});\n\n// or\n\nconst flight = new Flight();\nflight.departure = 'London';\nflight.destination = 'San Francisco';\nawait flight.save();\n\nawait Flight.select('destination').all();\n// [ { destination: \"Tokyo\" }, { destination: \"San Francisco\" } ]\n\nawait Flight.where('destination', 'Tokyo').delete();\n\nconst sfFlight = await Flight.select('destination').find(2);\n// { destination: \"San Francisco\" }\n\nawait Flight.count();\n// 1\n\nawait Flight.select('id', 'destination').orderBy('id').get();\n// [ { id: \"2\", destination: \"San Francisco\" } ]\n\nawait sfFlight.delete();\n\nawait db.close();\n```\n\n## First steps\n\nSetting up your database with DenoDB is a four-step process:\n\n- **Create a database**, using `Database` (learn more [about clients](#clients)):\n  ```typescript\n  const connection = new PostgresConnector({\n    host: '...',\n    username: 'user',\n    password: 'password',\n    database: 'airlines',\n  });\n\n  const db = new Database(connection);\n  ```\n- **Create models**, extending `Model`. `table` and `fields` are both required static attributes:\n\n  ```typescript\n  class User extends Model {\n    static table = 'users';\n\n    static timestamps = true;\n\n    static fields = {\n      id: {\n        primaryKey: true,\n        autoIncrement: true,\n      },\n      name: DataTypes.STRING,\n      email: {\n        type: DataTypes.STRING,\n        unique: true,\n        allowNull: false,\n        length: 50,\n      },\n    };\n  }\n  ```\n\n- **Link your models**, to add them to your database instance:\n  ```typescript\n  db.link([User]);\n  ```\n- Optional: **Create tables in your database**, by using `sync(...)`:\n  ```typescript\n  await db.sync();\n  ```\n- **Query your models!**\n  ```typescript\n  await User.create({ name: 'Amelia' });\n  await User.all();\n  await User.deleteById('1');\n  ```\n\n## Migrate from previous versions\n- `v1.0.21`: [Migrate to connectors](docs/v1.0.21-migrations/connectors.md)\n\n## License\n\nMIT License — [eveningkid](https://github.com/eveningkid)\n","funding_links":[],"categories":["TypeScript","基础设施","Modules","模块精选","sqlite"],"sub_categories":["Deno 源","Database","Assistants","数据库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feveningkid%2Fdenodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feveningkid%2Fdenodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feveningkid%2Fdenodb/lists"}