From de3a7d3cff00c78c052876d7f6bf4ee9c9bc42a2 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Mon, 13 Feb 2023 10:40:41 -0500 Subject: [PATCH] Fix missing fields in persistence layer for Connection data --- lib/objectbox-model.json | 27 +++++++++++++++- lib/objectbox.g.dart | 68 ++++++++++++++++++++++++++++++++++++---- pubspec.lock | 2 +- 3 files changed, 89 insertions(+), 8 deletions(-) diff --git a/lib/objectbox-model.json b/lib/objectbox-model.json index 2597277..3bbf76a 100644 --- a/lib/objectbox-model.json +++ b/lib/objectbox-model.json @@ -5,7 +5,7 @@ "entities": [ { "id": "1:1213035855270739890", - "lastPropertyId": "9:7727190023732579468", + "lastPropertyId": "14:7495390888349913259", "name": "Connection", "properties": [ { @@ -55,6 +55,31 @@ "id": "9:7727190023732579468", "name": "lastUpdateTime", "type": 10 + }, + { + "id": "10:7236128628019094924", + "name": "note", + "type": 9 + }, + { + "id": "11:714760695336940281", + "name": "followerCount", + "type": 6 + }, + { + "id": "12:4204087390924684186", + "name": "followingCount", + "type": 6 + }, + { + "id": "13:6842754750534163483", + "name": "statusesCount", + "type": 6 + }, + { + "id": "14:7495390888349913259", + "name": "lastStatus", + "type": 10 } ], "relations": [] diff --git a/lib/objectbox.g.dart b/lib/objectbox.g.dart index 82ec189..15e4315 100644 --- a/lib/objectbox.g.dart +++ b/lib/objectbox.g.dart @@ -23,7 +23,7 @@ final _entities = [ ModelEntity( id: const IdUid(1, 1213035855270739890), name: 'Connection', - lastPropertyId: const IdUid(9, 7727190023732579468), + lastPropertyId: const IdUid(14, 7495390888349913259), flags: 0, properties: [ ModelProperty( @@ -71,6 +71,31 @@ final _entities = [ id: const IdUid(9, 7727190023732579468), name: 'lastUpdateTime', type: 10, + flags: 0), + ModelProperty( + id: const IdUid(10, 7236128628019094924), + name: 'note', + type: 9, + flags: 0), + ModelProperty( + id: const IdUid(11, 714760695336940281), + name: 'followerCount', + type: 6, + flags: 0), + ModelProperty( + id: const IdUid(12, 4204087390924684186), + name: 'followingCount', + type: 6, + flags: 0), + ModelProperty( + id: const IdUid(13, 6842754750534163483), + name: 'statusesCount', + type: 6, + flags: 0), + ModelProperty( + id: const IdUid(14, 7495390888349913259), + name: 'lastStatus', + type: 10, flags: 0) ], relations: [], @@ -155,7 +180,8 @@ ModelDefinition getObjectBoxModel() { final networkOffset = fbb.writeString(object.network); final profileUrlOffset = fbb.writeString(object.profileUrl); final avatarUrlOffset = fbb.writeString(object.avatarUrl); - fbb.startTable(10); + final noteOffset = fbb.writeString(object.note); + fbb.startTable(15); fbb.addInt64(0, object.obId); fbb.addOffset(1, nameOffset); fbb.addOffset(2, handleOffset); @@ -165,13 +191,19 @@ ModelDefinition getObjectBoxModel() { fbb.addOffset(6, avatarUrlOffset); fbb.addInt64(7, object.dbStatus); fbb.addInt64(8, object.lastUpdateTime.millisecondsSinceEpoch); + fbb.addOffset(9, noteOffset); + fbb.addInt64(10, object.followerCount); + fbb.addInt64(11, object.followingCount); + fbb.addInt64(12, object.statusesCount); + fbb.addInt64(13, object.lastStatus?.millisecondsSinceEpoch); fbb.finish(fbb.endTable()); return object.obId; }, objectFromFB: (Store store, ByteData fbData) { final buffer = fb.BufferContext(fbData); final rootOffset = buffer.derefObject(0); - + final lastStatusValue = + const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 30); final object = Connection( obId: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0), name: const fb.StringReader(asciiOptimization: true) @@ -187,9 +219,13 @@ ModelDefinition getObjectBoxModel() { avatarUrl: const fb.StringReader(asciiOptimization: true) .vTableGet(buffer, rootOffset, 16, ''), lastUpdateTime: DateTime.fromMillisecondsSinceEpoch( - const fb.Int64Reader().vTableGet(buffer, rootOffset, 20, 0))) - ..dbStatus = - const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0); + const fb.Int64Reader().vTableGet(buffer, rootOffset, 20, 0)), + note: const fb.StringReader(asciiOptimization: true).vTableGet(buffer, rootOffset, 22, ''), + followerCount: const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 24), + followingCount: const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 26), + statusesCount: const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 28), + lastStatus: lastStatusValue == null ? null : DateTime.fromMillisecondsSinceEpoch(lastStatusValue)) + ..dbStatus = const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0); return object; }), @@ -268,6 +304,26 @@ class Connection_ { /// see [Connection.lastUpdateTime] static final lastUpdateTime = QueryIntegerProperty(_entities[0].properties[8]); + + /// see [Connection.note] + static final note = + QueryStringProperty(_entities[0].properties[9]); + + /// see [Connection.followerCount] + static final followerCount = + QueryIntegerProperty(_entities[0].properties[10]); + + /// see [Connection.followingCount] + static final followingCount = + QueryIntegerProperty(_entities[0].properties[11]); + + /// see [Connection.statusesCount] + static final statusesCount = + QueryIntegerProperty(_entities[0].properties[12]); + + /// see [Connection.lastStatus] + static final lastStatus = + QueryIntegerProperty(_entities[0].properties[13]); } /// [Hashtag] entity fields to define ObjectBox queries. diff --git a/pubspec.lock b/pubspec.lock index b7642e9..d290ee8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1278,5 +1278,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.18.2 <4.0.0" + dart: ">=2.18.2 <3.0.0" flutter: ">=3.3.0"