schema-dart
从 PostgreSQL 数据库模式生成 Dart 类型定义 (WIP)
安装
在软件包发布到 pub.dev 之前,可以按以下方式安装
[~] dart pub global activate schema_dart
或者
[~] dart pub global activate --source git https://github.com/osaxma/schema-dart.git
用法
在 dart/flutter 项目目录中,您可以运行以下示例之一
-
生成公共模式的数据类(默认)
schema-dart -c postgresql://postgres:postgres@localhost:54322/postgres -o path/to/output/directory -
为“cms”模式生成数据类
schema-dart -c <connection-string> -o <output-dir> -s cms -
为公共模式中的特定表生成数据类(格式敏感)
schema-dart -c <connection-string> -o <output-dir> -t "users","posts"或者
schema-dart -c <connection-string> -o <output-dir> --schema=api --tables="profiles","posts"
示例输出
以下文件夹:example/sample_output 包含来自 Supabase auth 模式的示例输出。