relax_orm_generator 1.0.1
relax_orm_generator: ^1.0.1 copied to clipboard
Code generator for relax_orm — generates TableSchema from annotated classes.
1.0.1 #
Fixed #
- Nullable JSON-backed fields no longer generate uncompilable
toMapcode. The null guard emitted for a nullable JSON column reused the field expression verbatim in itselsebranch —entity.replyToStory == null ? null : {'author': entity.replyToStory.author}. Dart does not promote a property access to non-nullable, so the generated file failed to compile with "The property 'author' can't be unconditionally accessed because the receiver can be 'null'" (and the equivalent error on.mapforList<T>?fields). The non-null branch now asserts non-nullity (entity.replyToStory!.author). Non-nullable JSON fields and the decoding side were unaffected.
Changed #
- Nullable columns whose encoding is a passthrough (
String?,int?, …) no longer emit a redundantx == null ? null : xguard.
1.0.0 #
First stable release. The generated TableSchema output is unchanged from
0.1.7 — the version bump commits to the current builder API and adds seeder
generation.
Added #
- Seeder generation. When enabled, every
@RelaxTablemodel also gets aTableSeedersubclass —User→UserSeeder— whosebuildOnefills each column with aSeedFakercall. Off by default; enable it withdart run relax_orm --seed, theseedbuilder option, or per model with@RelaxSeed(). @RelaxSeed(count:, order:, enabled:)support:countsets the generateddefaultCount,orderthedefaultOrder, andenabled: falseopts a model out even when seeding is on globally.- Builder options
seed(bool, defaultfalse) andseed_count(int, default10), readable frombuild.yamlor a--define. - Faker calls are picked from the column type and its name, so
emailgets an address,pricemoney-shaped numbers,created_ata past date. Nested models andList<T>fields are walked recursively; nullable columns are wrapped infaker.maybe(...). Self-referencing non-nullable models are reported as a generation error instead of recursing forever.
Changed #
- Requires
relax_orm >=1.1.0— generated seeders referenceTableSeederandSeedFaker, which that version introduces.
0.1.7 #
Changed #
- Widened the
relax_ormdependency constraint to>=0.1.7 <2.0.0so the generator works with the stablerelax_orm1.0.0 release. Generated output is unchanged (the generator only uses theTableSchemaAPI, which is unaffected by the 1.0.0 sync-adapter changes).
0.1.6 #
Added #
- Added support for JSON-backed serialization of nested model objects
- Added support for
List<T>fields whenTis a supported primitive or nested model type
Changed #
- Generator now encodes complex fields with
RelaxOrmJson.encode(...)and decodes them withRelaxOrmJson.decode(...) - Extended generated mapping support for nested values such as
DateTimeandUint8Listinside JSON-backed objects and lists
0.1.5 #
- Update dependencies
0.1.4 #
- Fixed conflict of analyser's version with other packages
0.1.1 #
Changed #
- Annotations are no longer duplicated in this package — now imported from
package:relax_orm/relax_orm_annotations.dart(single source of truth) - Added
relax_orm: ^0.1.0as a dependency - Added
issue_tracker,platformsmetadata to pubspec
Removed #
- Removed local
lib/src/annotations/directory (duplicate ofrelax_orm) - Removed
lib/relax_orm_annotations.dartre-export (no longer needed)
0.1.0 #
- Initial release
RelaxTableGeneratorgeneratesTableSchema<T>from@RelaxTable()annotated classes- Automatic camelCase to snake_case conversion for table and column names
- Support for
@PrimaryKey(),@Column(name:, nullable:, defaultValue:),@Ignore() - Supported types:
String,int,double,bool,DateTime,Uint8List(+ nullable)