bloom_db_generator 0.1.2 copy "bloom_db_generator: ^0.1.2" to clipboard
bloom_db_generator: ^0.1.2 copied to clipboard

build_runner code generator for bloom_db models — generates ModelMeta and row-mapping boilerplate from @BloomModel annotations.

bloom_db_generator #

build_runner code generator for bloom_db models. Generates ModelMeta, fieldValues(), and row-mapping boilerplate for classes annotated with @BloomModel, so you don't have to hand-write the ModelMeta/fromRow/fieldValues triple yourself.

Usage #

Add both bloom_db and bloom_db_generator to your pubspec.yaml:

dependencies:
  bloom_db: ^0.1.0

dev_dependencies:
  build_runner: ^2.4.9
  bloom_db_generator: ^0.1.0

Annotate your model and add a part directive:

import 'package:bloom_db/bloom_db.dart';

part 'user.g.dart';

@BloomModel(app: 'auth', tableName: 'auth_users')
class User with _$UserMixin {
  final int id;
  final String name;
  final String email;

  User({this.id = 0, required this.name, required this.email});
}

Then run:

dart run build_runner build

Part of Bloom Server #

bloom_db_generator is a dev-time tool for Bloom Server, the backend stack for the Bloom framework. Scaffold a full project with bloom server create <name> (from bloom_cli), or see examples/bloom_fullstack_todo in the Bloom monorepo for models declared the manual ModelMeta way (no codegen step) if you'd rather skip build_runner entirely.

License #

MIT

0
likes
140
points
259
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

build_runner code generator for bloom_db models — generates ModelMeta and row-mapping boilerplate from @BloomModel annotations.

Repository (GitHub)
View/report issues

Topics

#bloom #orm #codegen #build-runner

License

MIT (license)

Dependencies

analyzer, bloom_db, build, source_gen

More

Packages that depend on bloom_db_generator