パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.18.0

stormberry

DartクラスとPostgreSQLデータベースの間で簡単にバインディングを提供する、強力に型付けされたPostgreSQL ORMです。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
258
いいね数
138
Pub ポイント
150

パッケージをインストール

flutter pub add stormberry

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Stormberryは、Dart向けの強力な型付きPostgreSQL ORMであり、DartクラスとPostgreSQLデータベーステーブルとの間のマッピングを簡素化します。型安全なクエリとスキーマ管理を提供し、ボイラープレートコードを削減し、ランタイムエラーを最小限に抑えます。FlutterおよびDartアプリケーションで信頼性が高く、保守可能なデータベース操作を実現したい開発者向けに設計されており、明確で直感的なAPIを通じてPostgreSQLとシームレスに統合されます。このパッケージはAndroid、iOS、macOS、Windows、Linuxなど複数のプラットフォームをサポートしており、堅牢なバックエンドデータ処理を必要とするクロスプラットフォームアプリに最適です。

用途

  • PostgreSQL バックエンドを使用したクロスプラットフォームアプリの構築
  • Flutter における型安全なデータベース操作
  • スキーマのマイグレーションを自動化する
  • データレイヤーのコードにおけるボイラープレートの削減
  • PostgreSQL を Dart サービスと統合する

主な機能

  • 強タイプのエンティティマッピング
  • クエリのコンパイル時セキュリティ
  • プラットフォームに依存しないデータベースアクセスのサポート
  • 組み込みのマイグレーションユーティリティ
  • きれいな、読みやすいクエリ構文

適している対象

  • PostgreSQL を使用する Dart/Flutter 開発者
  • 型安全性を優先するチーム
  • スケーラブルなデータレイヤーを必要とするプロジェクト
  • 構造化データモデルを備えたバックエンドサービス
  • 一貫したデータベーススキーマ管理を必要とするアプリケーション

注意事項

  • PostgreSQL サーバーのセットアップが必要です
  • PostgreSQLに限定(他のデータベースは対象外)
  • ORM コンセプトの学習曲線
  • クライアントアプリケーションにおける安定したネットワーク接続に依存
  • 複雑なスキーマには追加の構成が必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Stormberry


A strongly-typed postgres ORM to provide easy bindings between your dart classes and postgres database. It supports all kinds of relations without any complex configuration.


Quick Start

To get started, add stormberry as a dependency and build_runner as a dev dependency:

dart pub add stormberry
dart pub add build_runner --dev

In your code, specify an abstract class that should act as a table like this:

// This file is "model.dart"
import 'package:stormberry/stormberry.dart';

// Will be generated by stormberry
part 'model.schema.dart';

@Model()
abstract class User {
  @PrimaryKey()
  String get id;

  String get name;
}

In order to generate the database code, run the following command:

dart run build_runner build

Tip: You'll need to re-run code generation each time you are making changes to your models. During development, you can use watch to automatically watch your changes: dart pub run build_runner watch.

This will generate a .schema.dart file that you should add as a part to the original model file.


Before running your application, you have to migrate your database. To do this run:

dart run stormberry migrate

This will ask you for the connection details of your postgres database and then migrate the database schema by adding the users table.


To access your database from your application, create a Database instance and use the users repository like this:

void main() async {
  
  var db = Database(
    // connection parameters go here
  );
  
  // adds a user to the 'users' table
  await db.users.insertOne(UserInsertRequest(id: 'abc', name: 'Alex'));
  
  // finds a user by its 'id'
  var user = await db.users.queryUser('abc');
  
  assert(user.name == 'Alex');
}

Full Documentation

See the full documentation here or jump directly to the topic you are looking for:

カテゴリー

依存関係

依存関係一覧 12 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。