Skip to content

Commit

Permalink
chore: update and fixes for dcm linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mathew65 committed Jan 21, 2025
1 parent d50ec30 commit 2349cc3
Show file tree
Hide file tree
Showing 13 changed files with 367 additions and 73 deletions.
285 changes: 285 additions & 0 deletions examples/drift/lib/db.drift.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// dart format width=80
// ignore_for_file: type=lint
part of 'db.dart';

Expand Down Expand Up @@ -157,6 +158,15 @@ class Todo extends DataClass implements Insertable<Todo> {
content: content ?? this.content,
category: category.present ? category.value : this.category,
);
Todo copyWithCompanion(TodosCompanion data) {
return Todo(
id: data.id.present ? data.id.value : this.id,
title: data.title.present ? data.title.value : this.title,
content: data.content.present ? data.content.value : this.content,
category: data.category.present ? data.category.value : this.category,
);
}

@override
String toString() {
return (StringBuffer('Todo(')
Expand Down Expand Up @@ -361,6 +371,14 @@ class Category extends DataClass implements Insertable<Category> {
id: id ?? this.id,
description: description ?? this.description,
);
Category copyWithCompanion(CategoriesCompanion data) {
return Category(
id: data.id.present ? data.id.value : this.id,
description:
data.description.present ? data.description.value : this.description,
);
}

@override
String toString() {
return (StringBuffer('Category(')
Expand Down Expand Up @@ -432,6 +450,7 @@ class CategoriesCompanion extends UpdateCompanion<Category> {

abstract class _$MyDatabase extends GeneratedDatabase {
_$MyDatabase(QueryExecutor e) : super(e);
$MyDatabaseManager get managers => $MyDatabaseManager(this);
late final $TodosTable todos = $TodosTable(this);
late final $CategoriesTable categories = $CategoriesTable(this);
@override
Expand All @@ -440,3 +459,269 @@ abstract class _$MyDatabase extends GeneratedDatabase {
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [todos, categories];
}

typedef $$TodosTableCreateCompanionBuilder = TodosCompanion Function({
Value<int> id,
required String title,
required String content,
Value<int?> category,
});
typedef $$TodosTableUpdateCompanionBuilder = TodosCompanion Function({
Value<int> id,
Value<String> title,
Value<String> content,
Value<int?> category,
});

class $$TodosTableFilterComposer extends Composer<_$MyDatabase, $TodosTable> {
$$TodosTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<int> get id => $composableBuilder(
column: $table.id, builder: (column) => ColumnFilters(column));

ColumnFilters<String> get title => $composableBuilder(
column: $table.title, builder: (column) => ColumnFilters(column));

ColumnFilters<String> get content => $composableBuilder(
column: $table.content, builder: (column) => ColumnFilters(column));

ColumnFilters<int> get category => $composableBuilder(
column: $table.category, builder: (column) => ColumnFilters(column));
}

class $$TodosTableOrderingComposer extends Composer<_$MyDatabase, $TodosTable> {
$$TodosTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<int> get id => $composableBuilder(
column: $table.id, builder: (column) => ColumnOrderings(column));

ColumnOrderings<String> get title => $composableBuilder(
column: $table.title, builder: (column) => ColumnOrderings(column));

ColumnOrderings<String> get content => $composableBuilder(
column: $table.content, builder: (column) => ColumnOrderings(column));

ColumnOrderings<int> get category => $composableBuilder(
column: $table.category, builder: (column) => ColumnOrderings(column));
}

class $$TodosTableAnnotationComposer
extends Composer<_$MyDatabase, $TodosTable> {
$$TodosTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);

GeneratedColumn<String> get title =>
$composableBuilder(column: $table.title, builder: (column) => column);

GeneratedColumn<String> get content =>
$composableBuilder(column: $table.content, builder: (column) => column);

GeneratedColumn<int> get category =>
$composableBuilder(column: $table.category, builder: (column) => column);
}

class $$TodosTableTableManager extends RootTableManager<
_$MyDatabase,
$TodosTable,
Todo,
$$TodosTableFilterComposer,
$$TodosTableOrderingComposer,
$$TodosTableAnnotationComposer,
$$TodosTableCreateCompanionBuilder,
$$TodosTableUpdateCompanionBuilder,
(Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>),
Todo,
PrefetchHooks Function()> {
$$TodosTableTableManager(_$MyDatabase db, $TodosTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TodosTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TodosTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TodosTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<String> title = const Value.absent(),
Value<String> content = const Value.absent(),
Value<int?> category = const Value.absent(),
}) =>
TodosCompanion(
id: id,
title: title,
content: content,
category: category,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
required String title,
required String content,
Value<int?> category = const Value.absent(),
}) =>
TodosCompanion.insert(
id: id,
title: title,
content: content,
category: category,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
));
}

typedef $$TodosTableProcessedTableManager = ProcessedTableManager<
_$MyDatabase,
$TodosTable,
Todo,
$$TodosTableFilterComposer,
$$TodosTableOrderingComposer,
$$TodosTableAnnotationComposer,
$$TodosTableCreateCompanionBuilder,
$$TodosTableUpdateCompanionBuilder,
(Todo, BaseReferences<_$MyDatabase, $TodosTable, Todo>),
Todo,
PrefetchHooks Function()>;
typedef $$CategoriesTableCreateCompanionBuilder = CategoriesCompanion Function({
Value<int> id,
required String description,
});
typedef $$CategoriesTableUpdateCompanionBuilder = CategoriesCompanion Function({
Value<int> id,
Value<String> description,
});

class $$CategoriesTableFilterComposer
extends Composer<_$MyDatabase, $CategoriesTable> {
$$CategoriesTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<int> get id => $composableBuilder(
column: $table.id, builder: (column) => ColumnFilters(column));

ColumnFilters<String> get description => $composableBuilder(
column: $table.description, builder: (column) => ColumnFilters(column));
}

class $$CategoriesTableOrderingComposer
extends Composer<_$MyDatabase, $CategoriesTable> {
$$CategoriesTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<int> get id => $composableBuilder(
column: $table.id, builder: (column) => ColumnOrderings(column));

ColumnOrderings<String> get description => $composableBuilder(
column: $table.description, builder: (column) => ColumnOrderings(column));
}

class $$CategoriesTableAnnotationComposer
extends Composer<_$MyDatabase, $CategoriesTable> {
$$CategoriesTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<int> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);

GeneratedColumn<String> get description => $composableBuilder(
column: $table.description, builder: (column) => column);
}

class $$CategoriesTableTableManager extends RootTableManager<
_$MyDatabase,
$CategoriesTable,
Category,
$$CategoriesTableFilterComposer,
$$CategoriesTableOrderingComposer,
$$CategoriesTableAnnotationComposer,
$$CategoriesTableCreateCompanionBuilder,
$$CategoriesTableUpdateCompanionBuilder,
(Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>),
Category,
PrefetchHooks Function()> {
$$CategoriesTableTableManager(_$MyDatabase db, $CategoriesTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$CategoriesTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$CategoriesTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$CategoriesTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<String> description = const Value.absent(),
}) =>
CategoriesCompanion(
id: id,
description: description,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
required String description,
}) =>
CategoriesCompanion.insert(
id: id,
description: description,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
));
}

typedef $$CategoriesTableProcessedTableManager = ProcessedTableManager<
_$MyDatabase,
$CategoriesTable,
Category,
$$CategoriesTableFilterComposer,
$$CategoriesTableOrderingComposer,
$$CategoriesTableAnnotationComposer,
$$CategoriesTableCreateCompanionBuilder,
$$CategoriesTableUpdateCompanionBuilder,
(Category, BaseReferences<_$MyDatabase, $CategoriesTable, Category>),
Category,
PrefetchHooks Function()>;

class $MyDatabaseManager {
final _$MyDatabase _db;
$MyDatabaseManager(this._db);
$$TodosTableTableManager get todos =>
$$TodosTableTableManager(_db, _db.todos);
$$CategoriesTableTableManager get categories =>
$$CategoriesTableTableManager(_db, _db.categories);
}
17 changes: 14 additions & 3 deletions examples/freezed/lib/freezed_example.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ mixin _$UserInfoUnion {
DateTime get updatedAt => throw _privateConstructorUsedError;
int get primarySectionId => throw _privateConstructorUsedError;

@JsonKey(ignore: true)
/// Create a copy of UserInfoUnion
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UserInfoUnionCopyWith<UserInfoUnion> get copyWith =>
throw _privateConstructorUsedError;
}
Expand Down Expand Up @@ -49,6 +51,8 @@ class _$UserInfoUnionCopyWithImpl<$Res, $Val extends UserInfoUnion>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of UserInfoUnion
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -101,6 +105,8 @@ class __$$UserInfoImplCopyWithImpl<$Res>
_$UserInfoImpl _value, $Res Function(_$UserInfoImpl) _then)
: super(_value, _then);

/// Create a copy of UserInfoUnion
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand Down Expand Up @@ -172,7 +178,9 @@ class _$UserInfoImpl implements UserInfo {
int get hashCode => Object.hash(
runtimeType, email, loginIdentifier, updatedAt, primarySectionId);

@JsonKey(ignore: true)
/// Create a copy of UserInfoUnion
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UserInfoImplCopyWith<_$UserInfoImpl> get copyWith =>
Expand All @@ -194,8 +202,11 @@ abstract class UserInfo implements UserInfoUnion {
DateTime get updatedAt;
@override
int get primarySectionId;

/// Create a copy of UserInfoUnion
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UserInfoImplCopyWith<_$UserInfoImpl> get copyWith =>
throw _privateConstructorUsedError;
}
16 changes: 8 additions & 8 deletions examples/injectable/lib/getit.config.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2349cc3

Please sign in to comment.