basalt_codegen 0.1.0 copy "basalt_codegen: ^0.1.0" to clipboard
basalt_codegen: ^0.1.0 copied to clipboard

build_runner code generator for the Basalt Dart ORM — derives row readers and INSERT/UPDATE builders from @Queryable, @Insertable, and @AsChangeset.

example/README.md

basalt_codegen example #

basalt_codegen is a build_runner generator — you drive it by annotating classes and running build_runner, not by calling an API. A complete, working setup (models, generated *.g.dart, and repositories) lives in the top-level example app (example/lib/data/models/).

Install #

# pubspec.yaml
dependencies:
  basalt: ^0.0.1

dev_dependencies:
  basalt_codegen: ^0.0.1
  build_runner: ^2.15.0

Annotate #

import 'package:basalt/basalt.dart';

part 'models.g.dart';

// Read model — generates a RowReader-based mapper + typed query getters.
@Queryable()
class User {
  const User(this.id, this.name, this.age);
  final int id;
  final String name;
  final int age;
}

// Write model — generates toInsert().
@Insertable()
class NewUser {
  const NewUser(this.id, this.name, this.age);
  final int id;
  final String name;
  final int age;
}

Generate #

$ dart run build_runner build

This emits models.g.dart with the readers and INSERT/UPDATE builders. See the getting-started guide for field mapping (@Column, readOnly/writeOnly) and @Relation.

0
likes
160
points
39
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

build_runner code generator for the Basalt Dart ORM — derives row readers and INSERT/UPDATE builders from @Queryable, @Insertable, and @AsChangeset.

Repository (GitHub)
View/report issues
Contributing

Topics

#orm #code-generation #build-runner #database

License

MIT (license)

Dependencies

analyzer, basalt, build, source_gen

More

Packages that depend on basalt_codegen