|
@@ -9,11 +9,11 @@ import 'package:objectbox/internal.dart'; // generated code can access "internal
|
|
|
import 'package:objectbox/objectbox.dart';
|
|
import 'package:objectbox/objectbox.dart';
|
|
|
import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';
|
|
import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';
|
|
|
|
|
|
|
|
-import 'entities/content.dart';
|
|
|
|
|
-import 'entities/friend.dart';
|
|
|
|
|
-import 'entities/message.dart';
|
|
|
|
|
-import 'entities/profile.dart';
|
|
|
|
|
-import 'entities/user.dart';
|
|
|
|
|
|
|
+import 'model/content.dart';
|
|
|
|
|
+import 'model/group.dart';
|
|
|
|
|
+import 'model/message.dart';
|
|
|
|
|
+import 'model/profile.dart';
|
|
|
|
|
+import 'model/user.dart';
|
|
|
|
|
|
|
|
export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
|
|
export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
|
|
|
|
|
|
|
@@ -34,11 +34,6 @@ final _entities = <ModelEntity>[
|
|
|
name: 'theme',
|
|
name: 'theme',
|
|
|
type: 6,
|
|
type: 6,
|
|
|
flags: 0),
|
|
flags: 0),
|
|
|
- ModelProperty(
|
|
|
|
|
- id: const IdUid(3, 7647214962273172849),
|
|
|
|
|
- name: 'username',
|
|
|
|
|
- type: 9,
|
|
|
|
|
- flags: 0),
|
|
|
|
|
ModelProperty(
|
|
ModelProperty(
|
|
|
id: const IdUid(4, 5923665807684456265),
|
|
id: const IdUid(4, 5923665807684456265),
|
|
|
name: 'isLogin',
|
|
name: 'isLogin',
|
|
@@ -66,43 +61,10 @@ final _entities = <ModelEntity>[
|
|
|
],
|
|
],
|
|
|
relations: <ModelRelation>[],
|
|
relations: <ModelRelation>[],
|
|
|
backlinks: <ModelBacklink>[]),
|
|
backlinks: <ModelBacklink>[]),
|
|
|
- ModelEntity(
|
|
|
|
|
- id: const IdUid(4, 5044745765388820377),
|
|
|
|
|
- name: 'Friend',
|
|
|
|
|
- lastPropertyId: const IdUid(3, 214180290351070734),
|
|
|
|
|
- flags: 0,
|
|
|
|
|
- properties: <ModelProperty>[
|
|
|
|
|
- ModelProperty(
|
|
|
|
|
- id: const IdUid(1, 5034484793468406763),
|
|
|
|
|
- name: 'id',
|
|
|
|
|
- type: 6,
|
|
|
|
|
- flags: 1),
|
|
|
|
|
- ModelProperty(
|
|
|
|
|
- id: const IdUid(2, 754684519442805673),
|
|
|
|
|
- name: 'user1Id',
|
|
|
|
|
- type: 11,
|
|
|
|
|
- flags: 520,
|
|
|
|
|
- indexId: const IdUid(2, 3790366672903506902),
|
|
|
|
|
- relationTarget: 'User'),
|
|
|
|
|
- ModelProperty(
|
|
|
|
|
- id: const IdUid(3, 214180290351070734),
|
|
|
|
|
- name: 'user2Id',
|
|
|
|
|
- type: 11,
|
|
|
|
|
- flags: 520,
|
|
|
|
|
- indexId: const IdUid(3, 1460593015267560936),
|
|
|
|
|
- relationTarget: 'User')
|
|
|
|
|
- ],
|
|
|
|
|
- relations: <ModelRelation>[
|
|
|
|
|
- ModelRelation(
|
|
|
|
|
- id: const IdUid(1, 5078486750954543598),
|
|
|
|
|
- name: 'messages',
|
|
|
|
|
- targetId: const IdUid(5, 8880211362757189177))
|
|
|
|
|
- ],
|
|
|
|
|
- backlinks: <ModelBacklink>[]),
|
|
|
|
|
ModelEntity(
|
|
ModelEntity(
|
|
|
id: const IdUid(5, 8880211362757189177),
|
|
id: const IdUid(5, 8880211362757189177),
|
|
|
name: 'Message',
|
|
name: 'Message',
|
|
|
- lastPropertyId: const IdUid(3, 7721473969164711791),
|
|
|
|
|
|
|
+ lastPropertyId: const IdUid(6, 4388824818686674479),
|
|
|
flags: 0,
|
|
flags: 0,
|
|
|
properties: <ModelProperty>[
|
|
properties: <ModelProperty>[
|
|
|
ModelProperty(
|
|
ModelProperty(
|
|
@@ -123,14 +85,26 @@ final _entities = <ModelEntity>[
|
|
|
type: 11,
|
|
type: 11,
|
|
|
flags: 520,
|
|
flags: 520,
|
|
|
indexId: const IdUid(5, 5329740598468773345),
|
|
indexId: const IdUid(5, 5329740598468773345),
|
|
|
- relationTarget: 'User')
|
|
|
|
|
|
|
+ relationTarget: 'User'),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(5, 634385368395524800),
|
|
|
|
|
+ name: 'time',
|
|
|
|
|
+ type: 6,
|
|
|
|
|
+ flags: 0),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(6, 4388824818686674479),
|
|
|
|
|
+ name: 'contentId',
|
|
|
|
|
+ type: 11,
|
|
|
|
|
+ flags: 520,
|
|
|
|
|
+ indexId: const IdUid(10, 205849996938840771),
|
|
|
|
|
+ relationTarget: 'Content')
|
|
|
],
|
|
],
|
|
|
relations: <ModelRelation>[],
|
|
relations: <ModelRelation>[],
|
|
|
backlinks: <ModelBacklink>[]),
|
|
backlinks: <ModelBacklink>[]),
|
|
|
ModelEntity(
|
|
ModelEntity(
|
|
|
id: const IdUid(6, 6066676571331973763),
|
|
id: const IdUid(6, 6066676571331973763),
|
|
|
name: 'User',
|
|
name: 'User',
|
|
|
- lastPropertyId: const IdUid(2, 2230815448876041069),
|
|
|
|
|
|
|
+ lastPropertyId: const IdUid(6, 3504407138147737485),
|
|
|
flags: 0,
|
|
flags: 0,
|
|
|
properties: <ModelProperty>[
|
|
properties: <ModelProperty>[
|
|
|
ModelProperty(
|
|
ModelProperty(
|
|
@@ -139,18 +113,104 @@ final _entities = <ModelEntity>[
|
|
|
type: 6,
|
|
type: 6,
|
|
|
flags: 1),
|
|
flags: 1),
|
|
|
ModelProperty(
|
|
ModelProperty(
|
|
|
- id: const IdUid(2, 2230815448876041069),
|
|
|
|
|
|
|
+ id: const IdUid(3, 2365120802531976993),
|
|
|
name: 'username',
|
|
name: 'username',
|
|
|
type: 9,
|
|
type: 9,
|
|
|
flags: 2080,
|
|
flags: 2080,
|
|
|
- indexId: const IdUid(6, 2181766053148811865))
|
|
|
|
|
|
|
+ indexId: const IdUid(9, 7432421428375491492)),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(4, 3332680204867820806),
|
|
|
|
|
+ name: 'isDND',
|
|
|
|
|
+ type: 1,
|
|
|
|
|
+ flags: 0),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(5, 2234651531374642771),
|
|
|
|
|
+ name: 'isStick',
|
|
|
|
|
+ type: 1,
|
|
|
|
|
+ flags: 0),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(6, 3504407138147737485),
|
|
|
|
|
+ name: 'isSpecialAttention',
|
|
|
|
|
+ type: 1,
|
|
|
|
|
+ flags: 0)
|
|
|
],
|
|
],
|
|
|
relations: <ModelRelation>[
|
|
relations: <ModelRelation>[
|
|
|
ModelRelation(
|
|
ModelRelation(
|
|
|
id: const IdUid(2, 3118435353931894829),
|
|
id: const IdUid(2, 3118435353931894829),
|
|
|
name: 'friends',
|
|
name: 'friends',
|
|
|
- targetId: const IdUid(4, 5044745765388820377))
|
|
|
|
|
|
|
+ targetId: const IdUid(6, 6066676571331973763)),
|
|
|
|
|
+ ModelRelation(
|
|
|
|
|
+ id: const IdUid(5, 8362659550242546106),
|
|
|
|
|
+ name: 'messages',
|
|
|
|
|
+ targetId: const IdUid(5, 8880211362757189177)),
|
|
|
|
|
+ ModelRelation(
|
|
|
|
|
+ id: const IdUid(6, 6570620621500888428),
|
|
|
|
|
+ name: 'groupMessages',
|
|
|
|
|
+ targetId: const IdUid(8, 8842794649328270120))
|
|
|
],
|
|
],
|
|
|
|
|
+ backlinks: <ModelBacklink>[]),
|
|
|
|
|
+ ModelEntity(
|
|
|
|
|
+ id: const IdUid(7, 1497196184348190204),
|
|
|
|
|
+ name: 'Group',
|
|
|
|
|
+ lastPropertyId: const IdUid(1, 8442786984080711776),
|
|
|
|
|
+ flags: 0,
|
|
|
|
|
+ properties: <ModelProperty>[
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(1, 8442786984080711776),
|
|
|
|
|
+ name: 'id',
|
|
|
|
|
+ type: 6,
|
|
|
|
|
+ flags: 1)
|
|
|
|
|
+ ],
|
|
|
|
|
+ relations: <ModelRelation>[
|
|
|
|
|
+ ModelRelation(
|
|
|
|
|
+ id: const IdUid(3, 7924032496731598926),
|
|
|
|
|
+ name: 'members',
|
|
|
|
|
+ targetId: const IdUid(6, 6066676571331973763)),
|
|
|
|
|
+ ModelRelation(
|
|
|
|
|
+ id: const IdUid(4, 1657013690878572102),
|
|
|
|
|
+ name: 'messages',
|
|
|
|
|
+ targetId: const IdUid(8, 8842794649328270120))
|
|
|
|
|
+ ],
|
|
|
|
|
+ backlinks: <ModelBacklink>[]),
|
|
|
|
|
+ ModelEntity(
|
|
|
|
|
+ id: const IdUid(8, 8842794649328270120),
|
|
|
|
|
+ name: 'GroupMessage',
|
|
|
|
|
+ lastPropertyId: const IdUid(6, 5148143939128616318),
|
|
|
|
|
+ flags: 0,
|
|
|
|
|
+ properties: <ModelProperty>[
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(1, 8727865543427007275),
|
|
|
|
|
+ name: 'id',
|
|
|
|
|
+ type: 6,
|
|
|
|
|
+ flags: 1),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(2, 5514462395021006262),
|
|
|
|
|
+ name: 'fromId',
|
|
|
|
|
+ type: 11,
|
|
|
|
|
+ flags: 520,
|
|
|
|
|
+ indexId: const IdUid(7, 5268783855356873237),
|
|
|
|
|
+ relationTarget: 'User'),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(3, 1148609827653786396),
|
|
|
|
|
+ name: 'toId',
|
|
|
|
|
+ type: 11,
|
|
|
|
|
+ flags: 520,
|
|
|
|
|
+ indexId: const IdUid(8, 7769527806721188121),
|
|
|
|
|
+ relationTarget: 'Group'),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(5, 7501600871221400279),
|
|
|
|
|
+ name: 'time',
|
|
|
|
|
+ type: 6,
|
|
|
|
|
+ flags: 0),
|
|
|
|
|
+ ModelProperty(
|
|
|
|
|
+ id: const IdUid(6, 5148143939128616318),
|
|
|
|
|
+ name: 'contentId',
|
|
|
|
|
+ type: 11,
|
|
|
|
|
+ flags: 520,
|
|
|
|
|
+ indexId: const IdUid(11, 6309601695170211538),
|
|
|
|
|
+ relationTarget: 'Content')
|
|
|
|
|
+ ],
|
|
|
|
|
+ relations: <ModelRelation>[],
|
|
|
backlinks: <ModelBacklink>[])
|
|
backlinks: <ModelBacklink>[])
|
|
|
];
|
|
];
|
|
|
|
|
|
|
@@ -174,17 +234,24 @@ Future<Store> openStore(
|
|
|
ModelDefinition getObjectBoxModel() {
|
|
ModelDefinition getObjectBoxModel() {
|
|
|
final model = ModelInfo(
|
|
final model = ModelInfo(
|
|
|
entities: _entities,
|
|
entities: _entities,
|
|
|
- lastEntityId: const IdUid(6, 6066676571331973763),
|
|
|
|
|
- lastIndexId: const IdUid(6, 2181766053148811865),
|
|
|
|
|
- lastRelationId: const IdUid(2, 3118435353931894829),
|
|
|
|
|
|
|
+ lastEntityId: const IdUid(8, 8842794649328270120),
|
|
|
|
|
+ lastIndexId: const IdUid(11, 6309601695170211538),
|
|
|
|
|
+ lastRelationId: const IdUid(6, 6570620621500888428),
|
|
|
lastSequenceId: const IdUid(0, 0),
|
|
lastSequenceId: const IdUid(0, 0),
|
|
|
- retiredEntityUids: const [3444477729893015694],
|
|
|
|
|
- retiredIndexUids: const [],
|
|
|
|
|
|
|
+ retiredEntityUids: const [3444477729893015694, 5044745765388820377],
|
|
|
|
|
+ retiredIndexUids: const [2181766053148811865],
|
|
|
retiredPropertyUids: const [
|
|
retiredPropertyUids: const [
|
|
|
5463014948149082651,
|
|
5463014948149082651,
|
|
|
2305308568754167021,
|
|
2305308568754167021,
|
|
|
649621747167423523,
|
|
649621747167423523,
|
|
|
- 4818206049188692305
|
|
|
|
|
|
|
+ 4818206049188692305,
|
|
|
|
|
+ 2230815448876041069,
|
|
|
|
|
+ 5034484793468406763,
|
|
|
|
|
+ 754684519442805673,
|
|
|
|
|
+ 214180290351070734,
|
|
|
|
|
+ 7647214962273172849,
|
|
|
|
|
+ 6701330857882848509,
|
|
|
|
|
+ 2182219019195059976
|
|
|
],
|
|
],
|
|
|
retiredRelationUids: const [],
|
|
retiredRelationUids: const [],
|
|
|
modelVersion: 5,
|
|
modelVersion: 5,
|
|
@@ -201,13 +268,9 @@ ModelDefinition getObjectBoxModel() {
|
|
|
object.id = id;
|
|
object.id = id;
|
|
|
},
|
|
},
|
|
|
objectToFB: (Profile object, fb.Builder fbb) {
|
|
objectToFB: (Profile object, fb.Builder fbb) {
|
|
|
- final usernameOffset = object.username == null
|
|
|
|
|
- ? null
|
|
|
|
|
- : fbb.writeString(object.username!);
|
|
|
|
|
fbb.startTable(8);
|
|
fbb.startTable(8);
|
|
|
fbb.addInt64(0, object.id);
|
|
fbb.addInt64(0, object.id);
|
|
|
fbb.addInt64(1, object.theme);
|
|
fbb.addInt64(1, object.theme);
|
|
|
- fbb.addOffset(2, usernameOffset);
|
|
|
|
|
fbb.addBool(3, object.isLogin);
|
|
fbb.addBool(3, object.isLogin);
|
|
|
fbb.addBool(6, object.isLogout);
|
|
fbb.addBool(6, object.isLogout);
|
|
|
fbb.finish(fbb.endTable());
|
|
fbb.finish(fbb.endTable());
|
|
@@ -220,8 +283,6 @@ ModelDefinition getObjectBoxModel() {
|
|
|
final object = Profile()
|
|
final object = Profile()
|
|
|
..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
|
|
..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
|
|
|
..theme = const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)
|
|
..theme = const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)
|
|
|
- ..username =
|
|
|
|
|
- const fb.StringReader().vTableGetNullable(buffer, rootOffset, 8)
|
|
|
|
|
..isLogin =
|
|
..isLogin =
|
|
|
const fb.BoolReader().vTableGet(buffer, rootOffset, 10, false)
|
|
const fb.BoolReader().vTableGet(buffer, rootOffset, 10, false)
|
|
|
..isLogout =
|
|
..isLogout =
|
|
@@ -252,52 +313,22 @@ ModelDefinition getObjectBoxModel() {
|
|
|
|
|
|
|
|
return object;
|
|
return object;
|
|
|
}),
|
|
}),
|
|
|
- Friend: EntityDefinition<Friend>(
|
|
|
|
|
- model: _entities[2],
|
|
|
|
|
- toOneRelations: (Friend object) => [object.user1, object.user2],
|
|
|
|
|
- toManyRelations: (Friend object) =>
|
|
|
|
|
- {RelInfo<Friend>.toMany(1, object.id): object.messages},
|
|
|
|
|
- getId: (Friend object) => object.id,
|
|
|
|
|
- setId: (Friend object, int id) {
|
|
|
|
|
- object.id = id;
|
|
|
|
|
- },
|
|
|
|
|
- objectToFB: (Friend object, fb.Builder fbb) {
|
|
|
|
|
- fbb.startTable(4);
|
|
|
|
|
- fbb.addInt64(0, object.id);
|
|
|
|
|
- fbb.addInt64(1, object.user1.targetId);
|
|
|
|
|
- fbb.addInt64(2, object.user2.targetId);
|
|
|
|
|
- fbb.finish(fbb.endTable());
|
|
|
|
|
- return object.id;
|
|
|
|
|
- },
|
|
|
|
|
- objectFromFB: (Store store, ByteData fbData) {
|
|
|
|
|
- final buffer = fb.BufferContext(fbData);
|
|
|
|
|
- final rootOffset = buffer.derefObject(0);
|
|
|
|
|
-
|
|
|
|
|
- final object = Friend()
|
|
|
|
|
- ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0);
|
|
|
|
|
- object.user1.targetId =
|
|
|
|
|
- const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0);
|
|
|
|
|
- object.user1.attach(store);
|
|
|
|
|
- object.user2.targetId =
|
|
|
|
|
- const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0);
|
|
|
|
|
- object.user2.attach(store);
|
|
|
|
|
- InternalToManyAccess.setRelInfo(object.messages, store,
|
|
|
|
|
- RelInfo<Friend>.toMany(1, object.id), store.box<Friend>());
|
|
|
|
|
- return object;
|
|
|
|
|
- }),
|
|
|
|
|
Message: EntityDefinition<Message>(
|
|
Message: EntityDefinition<Message>(
|
|
|
- model: _entities[3],
|
|
|
|
|
- toOneRelations: (Message object) => [object.from, object.to],
|
|
|
|
|
|
|
+ model: _entities[2],
|
|
|
|
|
+ toOneRelations: (Message object) =>
|
|
|
|
|
+ [object.from, object.to, object.content],
|
|
|
toManyRelations: (Message object) => {},
|
|
toManyRelations: (Message object) => {},
|
|
|
getId: (Message object) => object.id,
|
|
getId: (Message object) => object.id,
|
|
|
setId: (Message object, int id) {
|
|
setId: (Message object, int id) {
|
|
|
object.id = id;
|
|
object.id = id;
|
|
|
},
|
|
},
|
|
|
objectToFB: (Message object, fb.Builder fbb) {
|
|
objectToFB: (Message object, fb.Builder fbb) {
|
|
|
- fbb.startTable(4);
|
|
|
|
|
|
|
+ fbb.startTable(7);
|
|
|
fbb.addInt64(0, object.id);
|
|
fbb.addInt64(0, object.id);
|
|
|
fbb.addInt64(1, object.from.targetId);
|
|
fbb.addInt64(1, object.from.targetId);
|
|
|
fbb.addInt64(2, object.to.targetId);
|
|
fbb.addInt64(2, object.to.targetId);
|
|
|
|
|
+ fbb.addInt64(4, object.time);
|
|
|
|
|
+ fbb.addInt64(5, object.content.targetId);
|
|
|
fbb.finish(fbb.endTable());
|
|
fbb.finish(fbb.endTable());
|
|
|
return object.id;
|
|
return object.id;
|
|
|
},
|
|
},
|
|
@@ -306,29 +337,40 @@ ModelDefinition getObjectBoxModel() {
|
|
|
final rootOffset = buffer.derefObject(0);
|
|
final rootOffset = buffer.derefObject(0);
|
|
|
|
|
|
|
|
final object = Message()
|
|
final object = Message()
|
|
|
- ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0);
|
|
|
|
|
|
|
+ ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
|
|
|
|
|
+ ..time =
|
|
|
|
|
+ const fb.Int64Reader().vTableGet(buffer, rootOffset, 12, 0);
|
|
|
object.from.targetId =
|
|
object.from.targetId =
|
|
|
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0);
|
|
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0);
|
|
|
object.from.attach(store);
|
|
object.from.attach(store);
|
|
|
object.to.targetId =
|
|
object.to.targetId =
|
|
|
const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0);
|
|
const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0);
|
|
|
object.to.attach(store);
|
|
object.to.attach(store);
|
|
|
|
|
+ object.content.targetId =
|
|
|
|
|
+ const fb.Int64Reader().vTableGet(buffer, rootOffset, 14, 0);
|
|
|
|
|
+ object.content.attach(store);
|
|
|
return object;
|
|
return object;
|
|
|
}),
|
|
}),
|
|
|
User: EntityDefinition<User>(
|
|
User: EntityDefinition<User>(
|
|
|
- model: _entities[4],
|
|
|
|
|
|
|
+ model: _entities[3],
|
|
|
toOneRelations: (User object) => [],
|
|
toOneRelations: (User object) => [],
|
|
|
- toManyRelations: (User object) =>
|
|
|
|
|
- {RelInfo<User>.toMany(2, object.id): object.friends},
|
|
|
|
|
|
|
+ toManyRelations: (User object) => {
|
|
|
|
|
+ RelInfo<User>.toMany(2, object.id): object.friends,
|
|
|
|
|
+ RelInfo<User>.toMany(5, object.id): object.messages,
|
|
|
|
|
+ RelInfo<User>.toMany(6, object.id): object.groupMessages
|
|
|
|
|
+ },
|
|
|
getId: (User object) => object.id,
|
|
getId: (User object) => object.id,
|
|
|
setId: (User object, int id) {
|
|
setId: (User object, int id) {
|
|
|
object.id = id;
|
|
object.id = id;
|
|
|
},
|
|
},
|
|
|
objectToFB: (User object, fb.Builder fbb) {
|
|
objectToFB: (User object, fb.Builder fbb) {
|
|
|
final usernameOffset = fbb.writeString(object.username);
|
|
final usernameOffset = fbb.writeString(object.username);
|
|
|
- fbb.startTable(3);
|
|
|
|
|
|
|
+ fbb.startTable(7);
|
|
|
fbb.addInt64(0, object.id);
|
|
fbb.addInt64(0, object.id);
|
|
|
- fbb.addOffset(1, usernameOffset);
|
|
|
|
|
|
|
+ fbb.addOffset(2, usernameOffset);
|
|
|
|
|
+ fbb.addBool(3, object.isDND);
|
|
|
|
|
+ fbb.addBool(4, object.isStick);
|
|
|
|
|
+ fbb.addBool(5, object.isSpecialAttention);
|
|
|
fbb.finish(fbb.endTable());
|
|
fbb.finish(fbb.endTable());
|
|
|
return object.id;
|
|
return object.id;
|
|
|
},
|
|
},
|
|
@@ -337,11 +379,87 @@ ModelDefinition getObjectBoxModel() {
|
|
|
final rootOffset = buffer.derefObject(0);
|
|
final rootOffset = buffer.derefObject(0);
|
|
|
|
|
|
|
|
final object = User(
|
|
final object = User(
|
|
|
- id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
|
|
|
|
- username:
|
|
|
|
|
- const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''));
|
|
|
|
|
|
|
+ const fb.StringReader().vTableGet(buffer, rootOffset, 8, ''))
|
|
|
|
|
+ ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
|
|
|
|
|
+ ..isDND =
|
|
|
|
|
+ const fb.BoolReader().vTableGet(buffer, rootOffset, 10, false)
|
|
|
|
|
+ ..isStick =
|
|
|
|
|
+ const fb.BoolReader().vTableGet(buffer, rootOffset, 12, false)
|
|
|
|
|
+ ..isSpecialAttention =
|
|
|
|
|
+ const fb.BoolReader().vTableGet(buffer, rootOffset, 14, false);
|
|
|
InternalToManyAccess.setRelInfo(object.friends, store,
|
|
InternalToManyAccess.setRelInfo(object.friends, store,
|
|
|
RelInfo<User>.toMany(2, object.id), store.box<User>());
|
|
RelInfo<User>.toMany(2, object.id), store.box<User>());
|
|
|
|
|
+ InternalToManyAccess.setRelInfo(object.messages, store,
|
|
|
|
|
+ RelInfo<User>.toMany(5, object.id), store.box<User>());
|
|
|
|
|
+ InternalToManyAccess.setRelInfo(object.groupMessages, store,
|
|
|
|
|
+ RelInfo<User>.toMany(6, object.id), store.box<User>());
|
|
|
|
|
+ return object;
|
|
|
|
|
+ }),
|
|
|
|
|
+ Group: EntityDefinition<Group>(
|
|
|
|
|
+ model: _entities[4],
|
|
|
|
|
+ toOneRelations: (Group object) => [],
|
|
|
|
|
+ toManyRelations: (Group object) => {
|
|
|
|
|
+ RelInfo<Group>.toMany(3, object.id): object.members,
|
|
|
|
|
+ RelInfo<Group>.toMany(4, object.id): object.messages
|
|
|
|
|
+ },
|
|
|
|
|
+ getId: (Group object) => object.id,
|
|
|
|
|
+ setId: (Group object, int id) {
|
|
|
|
|
+ object.id = id;
|
|
|
|
|
+ },
|
|
|
|
|
+ objectToFB: (Group object, fb.Builder fbb) {
|
|
|
|
|
+ fbb.startTable(2);
|
|
|
|
|
+ fbb.addInt64(0, object.id);
|
|
|
|
|
+ fbb.finish(fbb.endTable());
|
|
|
|
|
+ return object.id;
|
|
|
|
|
+ },
|
|
|
|
|
+ objectFromFB: (Store store, ByteData fbData) {
|
|
|
|
|
+ final buffer = fb.BufferContext(fbData);
|
|
|
|
|
+ final rootOffset = buffer.derefObject(0);
|
|
|
|
|
+
|
|
|
|
|
+ final object = Group()
|
|
|
|
|
+ ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0);
|
|
|
|
|
+ InternalToManyAccess.setRelInfo(object.members, store,
|
|
|
|
|
+ RelInfo<Group>.toMany(3, object.id), store.box<Group>());
|
|
|
|
|
+ InternalToManyAccess.setRelInfo(object.messages, store,
|
|
|
|
|
+ RelInfo<Group>.toMany(4, object.id), store.box<Group>());
|
|
|
|
|
+ return object;
|
|
|
|
|
+ }),
|
|
|
|
|
+ GroupMessage: EntityDefinition<GroupMessage>(
|
|
|
|
|
+ model: _entities[5],
|
|
|
|
|
+ toOneRelations: (GroupMessage object) =>
|
|
|
|
|
+ [object.from, object.to, object.content],
|
|
|
|
|
+ toManyRelations: (GroupMessage object) => {},
|
|
|
|
|
+ getId: (GroupMessage object) => object.id,
|
|
|
|
|
+ setId: (GroupMessage object, int id) {
|
|
|
|
|
+ object.id = id;
|
|
|
|
|
+ },
|
|
|
|
|
+ objectToFB: (GroupMessage object, fb.Builder fbb) {
|
|
|
|
|
+ fbb.startTable(7);
|
|
|
|
|
+ fbb.addInt64(0, object.id);
|
|
|
|
|
+ fbb.addInt64(1, object.from.targetId);
|
|
|
|
|
+ fbb.addInt64(2, object.to.targetId);
|
|
|
|
|
+ fbb.addInt64(4, object.time);
|
|
|
|
|
+ fbb.addInt64(5, object.content.targetId);
|
|
|
|
|
+ fbb.finish(fbb.endTable());
|
|
|
|
|
+ return object.id;
|
|
|
|
|
+ },
|
|
|
|
|
+ objectFromFB: (Store store, ByteData fbData) {
|
|
|
|
|
+ final buffer = fb.BufferContext(fbData);
|
|
|
|
|
+ final rootOffset = buffer.derefObject(0);
|
|
|
|
|
+
|
|
|
|
|
+ final object = GroupMessage()
|
|
|
|
|
+ ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
|
|
|
|
|
+ ..time =
|
|
|
|
|
+ const fb.Int64Reader().vTableGet(buffer, rootOffset, 12, 0);
|
|
|
|
|
+ object.from.targetId =
|
|
|
|
|
+ const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0);
|
|
|
|
|
+ object.from.attach(store);
|
|
|
|
|
+ object.to.targetId =
|
|
|
|
|
+ const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0);
|
|
|
|
|
+ object.to.attach(store);
|
|
|
|
|
+ object.content.targetId =
|
|
|
|
|
+ const fb.Int64Reader().vTableGet(buffer, rootOffset, 14, 0);
|
|
|
|
|
+ object.content.attach(store);
|
|
|
return object;
|
|
return object;
|
|
|
})
|
|
})
|
|
|
};
|
|
};
|
|
@@ -358,17 +476,13 @@ class Profile_ {
|
|
|
static final theme =
|
|
static final theme =
|
|
|
QueryIntegerProperty<Profile>(_entities[0].properties[1]);
|
|
QueryIntegerProperty<Profile>(_entities[0].properties[1]);
|
|
|
|
|
|
|
|
- /// see [Profile.username]
|
|
|
|
|
- static final username =
|
|
|
|
|
- QueryStringProperty<Profile>(_entities[0].properties[2]);
|
|
|
|
|
-
|
|
|
|
|
/// see [Profile.isLogin]
|
|
/// see [Profile.isLogin]
|
|
|
static final isLogin =
|
|
static final isLogin =
|
|
|
- QueryBooleanProperty<Profile>(_entities[0].properties[3]);
|
|
|
|
|
|
|
+ QueryBooleanProperty<Profile>(_entities[0].properties[2]);
|
|
|
|
|
|
|
|
/// see [Profile.isLogout]
|
|
/// see [Profile.isLogout]
|
|
|
static final isLogout =
|
|
static final isLogout =
|
|
|
- QueryBooleanProperty<Profile>(_entities[0].properties[4]);
|
|
|
|
|
|
|
+ QueryBooleanProperty<Profile>(_entities[0].properties[3]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// [Content] entity fields to define ObjectBox queries.
|
|
/// [Content] entity fields to define ObjectBox queries.
|
|
@@ -377,47 +491,91 @@ class Content_ {
|
|
|
static final id = QueryIntegerProperty<Content>(_entities[1].properties[0]);
|
|
static final id = QueryIntegerProperty<Content>(_entities[1].properties[0]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/// [Friend] entity fields to define ObjectBox queries.
|
|
|
|
|
-class Friend_ {
|
|
|
|
|
- /// see [Friend.id]
|
|
|
|
|
- static final id = QueryIntegerProperty<Friend>(_entities[2].properties[0]);
|
|
|
|
|
-
|
|
|
|
|
- /// see [Friend.user1]
|
|
|
|
|
- static final user1 =
|
|
|
|
|
- QueryRelationToOne<Friend, User>(_entities[2].properties[1]);
|
|
|
|
|
-
|
|
|
|
|
- /// see [Friend.user2]
|
|
|
|
|
- static final user2 =
|
|
|
|
|
- QueryRelationToOne<Friend, User>(_entities[2].properties[2]);
|
|
|
|
|
-
|
|
|
|
|
- /// see [Friend.messages]
|
|
|
|
|
- static final messages =
|
|
|
|
|
- QueryRelationToMany<Friend, Message>(_entities[2].relations[0]);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/// [Message] entity fields to define ObjectBox queries.
|
|
/// [Message] entity fields to define ObjectBox queries.
|
|
|
class Message_ {
|
|
class Message_ {
|
|
|
/// see [Message.id]
|
|
/// see [Message.id]
|
|
|
- static final id = QueryIntegerProperty<Message>(_entities[3].properties[0]);
|
|
|
|
|
|
|
+ static final id = QueryIntegerProperty<Message>(_entities[2].properties[0]);
|
|
|
|
|
|
|
|
/// see [Message.from]
|
|
/// see [Message.from]
|
|
|
static final from =
|
|
static final from =
|
|
|
- QueryRelationToOne<Message, User>(_entities[3].properties[1]);
|
|
|
|
|
|
|
+ QueryRelationToOne<Message, User>(_entities[2].properties[1]);
|
|
|
|
|
|
|
|
/// see [Message.to]
|
|
/// see [Message.to]
|
|
|
static final to =
|
|
static final to =
|
|
|
- QueryRelationToOne<Message, User>(_entities[3].properties[2]);
|
|
|
|
|
|
|
+ QueryRelationToOne<Message, User>(_entities[2].properties[2]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [Message.time]
|
|
|
|
|
+ static final time = QueryIntegerProperty<Message>(_entities[2].properties[3]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [Message.content]
|
|
|
|
|
+ static final content =
|
|
|
|
|
+ QueryRelationToOne<Message, Content>(_entities[2].properties[4]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// [User] entity fields to define ObjectBox queries.
|
|
/// [User] entity fields to define ObjectBox queries.
|
|
|
class User_ {
|
|
class User_ {
|
|
|
/// see [User.id]
|
|
/// see [User.id]
|
|
|
- static final id = QueryIntegerProperty<User>(_entities[4].properties[0]);
|
|
|
|
|
|
|
+ static final id = QueryIntegerProperty<User>(_entities[3].properties[0]);
|
|
|
|
|
|
|
|
/// see [User.username]
|
|
/// see [User.username]
|
|
|
- static final username = QueryStringProperty<User>(_entities[4].properties[1]);
|
|
|
|
|
|
|
+ static final username = QueryStringProperty<User>(_entities[3].properties[1]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [User.isDND]
|
|
|
|
|
+ static final isDND = QueryBooleanProperty<User>(_entities[3].properties[2]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [User.isStick]
|
|
|
|
|
+ static final isStick = QueryBooleanProperty<User>(_entities[3].properties[3]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [User.isSpecialAttention]
|
|
|
|
|
+ static final isSpecialAttention =
|
|
|
|
|
+ QueryBooleanProperty<User>(_entities[3].properties[4]);
|
|
|
|
|
|
|
|
/// see [User.friends]
|
|
/// see [User.friends]
|
|
|
static final friends =
|
|
static final friends =
|
|
|
- QueryRelationToMany<User, Friend>(_entities[4].relations[0]);
|
|
|
|
|
|
|
+ QueryRelationToMany<User, User>(_entities[3].relations[0]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [User.messages]
|
|
|
|
|
+ static final messages =
|
|
|
|
|
+ QueryRelationToMany<User, Message>(_entities[3].relations[1]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [User.groupMessages]
|
|
|
|
|
+ static final groupMessages =
|
|
|
|
|
+ QueryRelationToMany<User, GroupMessage>(_entities[3].relations[2]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/// [Group] entity fields to define ObjectBox queries.
|
|
|
|
|
+class Group_ {
|
|
|
|
|
+ /// see [Group.id]
|
|
|
|
|
+ static final id = QueryIntegerProperty<Group>(_entities[4].properties[0]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [Group.members]
|
|
|
|
|
+ static final members =
|
|
|
|
|
+ QueryRelationToMany<Group, User>(_entities[4].relations[0]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [Group.messages]
|
|
|
|
|
+ static final messages =
|
|
|
|
|
+ QueryRelationToMany<Group, GroupMessage>(_entities[4].relations[1]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/// [GroupMessage] entity fields to define ObjectBox queries.
|
|
|
|
|
+class GroupMessage_ {
|
|
|
|
|
+ /// see [GroupMessage.id]
|
|
|
|
|
+ static final id =
|
|
|
|
|
+ QueryIntegerProperty<GroupMessage>(_entities[5].properties[0]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [GroupMessage.from]
|
|
|
|
|
+ static final from =
|
|
|
|
|
+ QueryRelationToOne<GroupMessage, User>(_entities[5].properties[1]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [GroupMessage.to]
|
|
|
|
|
+ static final to =
|
|
|
|
|
+ QueryRelationToOne<GroupMessage, Group>(_entities[5].properties[2]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [GroupMessage.time]
|
|
|
|
|
+ static final time =
|
|
|
|
|
+ QueryIntegerProperty<GroupMessage>(_entities[5].properties[3]);
|
|
|
|
|
+
|
|
|
|
|
+ /// see [GroupMessage.content]
|
|
|
|
|
+ static final content =
|
|
|
|
|
+ QueryRelationToOne<GroupMessage, Content>(_entities[5].properties[4]);
|
|
|
}
|
|
}
|