{"id":27101411,"url":"https://github.com/pyrestudios/dwell","last_synced_at":"2025-04-06T14:36:48.426Z","repository":{"id":104448539,"uuid":"487066683","full_name":"PyreStudios/dwell","owner":"PyreStudios","description":"An EXPERIMENTAL reflection-based data access layer for Dart","archived":false,"fork":false,"pushed_at":"2024-04-05T03:05:11.000Z","size":48,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-01T11:28:33.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PyreStudios.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-04-29T18:02:10.000Z","updated_at":"2022-06-05T02:09:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d3e1b5c-848a-482c-8d55-03f9e9ec009f","html_url":"https://github.com/PyreStudios/dwell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyreStudios%2Fdwell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyreStudios%2Fdwell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyreStudios%2Fdwell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyreStudios%2Fdwell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyreStudios","download_url":"https://codeload.github.com/PyreStudios/dwell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247497234,"owners_count":20948383,"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":[],"created_at":"2025-04-06T14:36:47.802Z","updated_at":"2025-04-06T14:36:48.409Z","avatar_url":"https://github.com/PyreStudios.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- \nThis README describes the package. If you publish this package to pub.dev,\nthis README's contents appear on the landing page for your package.\n\nFor information about how to write a good package README, see the guide for\n[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). \n\nFor general information about developing packages, see the Dart guide for\n[creating packages](https://dart.dev/guides/libraries/create-library-packages)\nand the Flutter guide for\n[developing packages and plugins](https://flutter.dev/developing-packages). \n--\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eDwell\u003c/h1\u003e\n  \n  \u003ch2 align=\"center\"\u003eA reflection based data abstraction layer for Dart\u003c/h2\u003e\n\u003c/p\u003e\n\n\u003c!-- [![pub version](https://img.shields.io/pub/v/dwell)](https://img.shields.io/pub/v/dwell) --\u003e\n[![codecov](https://codecov.io/gh/PyreStudios/dwell/branch/main/graph/badge.svg?token=CAK5MR60ZI)](https://codecov.io/gh/PyreStudios/dwell)\n\u003c!-- [![points](https://img.shields.io/pub/points/dwell)](https://img.shields.io/pub/points/dwell)\n[![likes](https://img.shields.io/pub/points/dwell)](https://img.shields.io/pub/points/dwell) --\u003e\n\nThis package is intended for non-clientside development (servers, clis, etc). It uses reflection and will not work with Flutter (sorry). If you find this package useful, please voice your opinion on [keeping reflection around in dart here](https://github.com/dart-lang/sdk/issues/44489).\n\n## Features\n\nDwell helps create a data abstraction layer (like an ORM sort of, but not quite) by providing a DSL for creating and executing queries against common databases. Dwell tries to keep you in control of your queries, but helps abstract some of the pain points away.\n\nCurrently, we only support Postgres, but adding adapter support for other databases should be relatively painless.\n## Getting started\n\nTODO: List prerequisites and provide or point to information on how to\nstart using the package.\n\n## Usage\n\n```dart\nimport 'package:dwell/dwell.dart';\nimport 'package:dwell/src/adapters/postgres_adapter.dart';\nimport 'package:postgres/postgres.dart';\n\nclass Post implements SchemaObject {\n  String uuid;\n  String content;\n\n  // Dwell only supports named parameters.\n  Post({required this.uuid, required this.content});\n\n  @override\n  Map\u003cString, dynamic\u003e toMap() {\n    return {\n      'uuid': uuid,\n      'content': content,\n    };\n  }\n}\n\nfinal _adapter = PostgresAdapter(\n    connection: PostgreSQLConnection(\"localhost\", 5432, \"dart_test\",\n        username: \"dart\", password: \"dart\"));\n\nclass PostsTable extends Table\u003cPost\u003e {\n  PostsTable() : super(name: 'posts');\n  @override\n  Adapter get adapter =\u003e _adapter;\n\n  static final uuid = Column\u003cString\u003e('uuid', primaryKey: true);\n  static final content = Column\u003cString\u003e('content');\n}\n\nvoid main() async {\n  var p = Post(\n    'abc-123',\n    'This is a test post',\n  );\n\n  var table = PostsTable();\n  // For now, adapter opening and closing needs to be controlled by the user\n  await _adapter.open();\n\n  // You should probably use migrations instead of something like this, but\n  // we're not your parents, so we won't stop you.\n  await _adapter.connection.execute('''\n    CREATE TABLE IF NOT EXISTS posts (\n      uuid varchar(255) NOT NULL,\n      content text NOT NULL,\n      PRIMARY KEY (uuid)\n    );\n''');\n\n  await table.delete().where(PostsTable.uuid, '=', p.uuid).execute();\n  await table.insert(p);\n  // update content\n  p.content = \"fresh content only\";\n  // persist updated content\n  await table.update(p).execute();\n  final post = await table.findByPk('abc-123');\n  print(post.toMap());\n\n  await _adapter.close();\n}\n```\n\n## Additional information\n\nTODO: Tell users more about the package: where to find more information, how to \ncontribute to the package, how to file issues, what response they can expect \nfrom the package authors, and more.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrestudios%2Fdwell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrestudios%2Fdwell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrestudios%2Fdwell/lists"}