objectbox.g.dart 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. // GENERATED CODE - DO NOT MODIFY BY HAND
  2. // ignore_for_file: camel_case_types
  3. import 'dart:typed_data';
  4. import 'package:objectbox/flatbuffers/flat_buffers.dart' as fb;
  5. import 'package:objectbox/internal.dart'; // generated code can access "internal" functionality
  6. import 'package:objectbox/objectbox.dart';
  7. import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';
  8. import 'model/content.dart';
  9. import 'model/group.dart';
  10. import 'model/message.dart';
  11. import 'model/profile.dart';
  12. import 'model/user.dart';
  13. export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
  14. final _entities = <ModelEntity>[
  15. ModelEntity(
  16. id: const IdUid(2, 1438354990151910015),
  17. name: 'Profile',
  18. lastPropertyId: const IdUid(7, 4763561980566319174),
  19. flags: 0,
  20. properties: <ModelProperty>[
  21. ModelProperty(
  22. id: const IdUid(1, 3873481118333862410),
  23. name: 'id',
  24. type: 6,
  25. flags: 1),
  26. ModelProperty(
  27. id: const IdUid(2, 9078004558710481468),
  28. name: 'theme',
  29. type: 6,
  30. flags: 0),
  31. ModelProperty(
  32. id: const IdUid(4, 5923665807684456265),
  33. name: 'isLogin',
  34. type: 1,
  35. flags: 0),
  36. ModelProperty(
  37. id: const IdUid(7, 4763561980566319174),
  38. name: 'isLogout',
  39. type: 1,
  40. flags: 0)
  41. ],
  42. relations: <ModelRelation>[],
  43. backlinks: <ModelBacklink>[]),
  44. ModelEntity(
  45. id: const IdUid(3, 2132486004932842474),
  46. name: 'Content',
  47. lastPropertyId: const IdUid(1, 8861377786907255369),
  48. flags: 0,
  49. properties: <ModelProperty>[
  50. ModelProperty(
  51. id: const IdUid(1, 8861377786907255369),
  52. name: 'id',
  53. type: 6,
  54. flags: 1)
  55. ],
  56. relations: <ModelRelation>[],
  57. backlinks: <ModelBacklink>[]),
  58. ModelEntity(
  59. id: const IdUid(5, 8880211362757189177),
  60. name: 'Message',
  61. lastPropertyId: const IdUid(6, 4388824818686674479),
  62. flags: 0,
  63. properties: <ModelProperty>[
  64. ModelProperty(
  65. id: const IdUid(1, 8816894358087325317),
  66. name: 'id',
  67. type: 6,
  68. flags: 1),
  69. ModelProperty(
  70. id: const IdUid(2, 7982216815340584307),
  71. name: 'fromId',
  72. type: 11,
  73. flags: 520,
  74. indexId: const IdUid(4, 6495021264194887400),
  75. relationTarget: 'User'),
  76. ModelProperty(
  77. id: const IdUid(3, 7721473969164711791),
  78. name: 'toId',
  79. type: 11,
  80. flags: 520,
  81. indexId: const IdUid(5, 5329740598468773345),
  82. relationTarget: 'User'),
  83. ModelProperty(
  84. id: const IdUid(5, 634385368395524800),
  85. name: 'time',
  86. type: 6,
  87. flags: 0),
  88. ModelProperty(
  89. id: const IdUid(6, 4388824818686674479),
  90. name: 'contentId',
  91. type: 11,
  92. flags: 520,
  93. indexId: const IdUid(10, 205849996938840771),
  94. relationTarget: 'Content')
  95. ],
  96. relations: <ModelRelation>[],
  97. backlinks: <ModelBacklink>[]),
  98. ModelEntity(
  99. id: const IdUid(6, 6066676571331973763),
  100. name: 'User',
  101. lastPropertyId: const IdUid(6, 3504407138147737485),
  102. flags: 0,
  103. properties: <ModelProperty>[
  104. ModelProperty(
  105. id: const IdUid(1, 5757871925438229578),
  106. name: 'id',
  107. type: 6,
  108. flags: 1),
  109. ModelProperty(
  110. id: const IdUid(3, 2365120802531976993),
  111. name: 'username',
  112. type: 9,
  113. flags: 2080,
  114. indexId: const IdUid(9, 7432421428375491492)),
  115. ModelProperty(
  116. id: const IdUid(4, 3332680204867820806),
  117. name: 'isDND',
  118. type: 1,
  119. flags: 0),
  120. ModelProperty(
  121. id: const IdUid(5, 2234651531374642771),
  122. name: 'isStick',
  123. type: 1,
  124. flags: 0),
  125. ModelProperty(
  126. id: const IdUid(6, 3504407138147737485),
  127. name: 'isSpecialAttention',
  128. type: 1,
  129. flags: 0)
  130. ],
  131. relations: <ModelRelation>[
  132. ModelRelation(
  133. id: const IdUid(2, 3118435353931894829),
  134. name: 'friends',
  135. targetId: const IdUid(6, 6066676571331973763)),
  136. ModelRelation(
  137. id: const IdUid(5, 8362659550242546106),
  138. name: 'messages',
  139. targetId: const IdUid(5, 8880211362757189177)),
  140. ModelRelation(
  141. id: const IdUid(6, 6570620621500888428),
  142. name: 'groupMessages',
  143. targetId: const IdUid(8, 8842794649328270120))
  144. ],
  145. backlinks: <ModelBacklink>[]),
  146. ModelEntity(
  147. id: const IdUid(7, 1497196184348190204),
  148. name: 'Group',
  149. lastPropertyId: const IdUid(1, 8442786984080711776),
  150. flags: 0,
  151. properties: <ModelProperty>[
  152. ModelProperty(
  153. id: const IdUid(1, 8442786984080711776),
  154. name: 'id',
  155. type: 6,
  156. flags: 1)
  157. ],
  158. relations: <ModelRelation>[
  159. ModelRelation(
  160. id: const IdUid(3, 7924032496731598926),
  161. name: 'members',
  162. targetId: const IdUid(6, 6066676571331973763)),
  163. ModelRelation(
  164. id: const IdUid(4, 1657013690878572102),
  165. name: 'messages',
  166. targetId: const IdUid(8, 8842794649328270120))
  167. ],
  168. backlinks: <ModelBacklink>[]),
  169. ModelEntity(
  170. id: const IdUid(8, 8842794649328270120),
  171. name: 'GroupMessage',
  172. lastPropertyId: const IdUid(6, 5148143939128616318),
  173. flags: 0,
  174. properties: <ModelProperty>[
  175. ModelProperty(
  176. id: const IdUid(1, 8727865543427007275),
  177. name: 'id',
  178. type: 6,
  179. flags: 1),
  180. ModelProperty(
  181. id: const IdUid(2, 5514462395021006262),
  182. name: 'fromId',
  183. type: 11,
  184. flags: 520,
  185. indexId: const IdUid(7, 5268783855356873237),
  186. relationTarget: 'User'),
  187. ModelProperty(
  188. id: const IdUid(3, 1148609827653786396),
  189. name: 'toId',
  190. type: 11,
  191. flags: 520,
  192. indexId: const IdUid(8, 7769527806721188121),
  193. relationTarget: 'Group'),
  194. ModelProperty(
  195. id: const IdUid(5, 7501600871221400279),
  196. name: 'time',
  197. type: 6,
  198. flags: 0),
  199. ModelProperty(
  200. id: const IdUid(6, 5148143939128616318),
  201. name: 'contentId',
  202. type: 11,
  203. flags: 520,
  204. indexId: const IdUid(11, 6309601695170211538),
  205. relationTarget: 'Content')
  206. ],
  207. relations: <ModelRelation>[],
  208. backlinks: <ModelBacklink>[])
  209. ];
  210. /// Open an ObjectBox store with the model declared in this file.
  211. Future<Store> openStore(
  212. {String? directory,
  213. int? maxDBSizeInKB,
  214. int? fileMode,
  215. int? maxReaders,
  216. bool queriesCaseSensitiveDefault = true,
  217. String? macosApplicationGroup}) async =>
  218. Store(getObjectBoxModel(),
  219. directory: directory ?? (await defaultStoreDirectory()).path,
  220. maxDBSizeInKB: maxDBSizeInKB,
  221. fileMode: fileMode,
  222. maxReaders: maxReaders,
  223. queriesCaseSensitiveDefault: queriesCaseSensitiveDefault,
  224. macosApplicationGroup: macosApplicationGroup);
  225. /// ObjectBox model definition, pass it to [Store] - Store(getObjectBoxModel())
  226. ModelDefinition getObjectBoxModel() {
  227. final model = ModelInfo(
  228. entities: _entities,
  229. lastEntityId: const IdUid(8, 8842794649328270120),
  230. lastIndexId: const IdUid(11, 6309601695170211538),
  231. lastRelationId: const IdUid(6, 6570620621500888428),
  232. lastSequenceId: const IdUid(0, 0),
  233. retiredEntityUids: const [3444477729893015694, 5044745765388820377],
  234. retiredIndexUids: const [2181766053148811865],
  235. retiredPropertyUids: const [
  236. 5463014948149082651,
  237. 2305308568754167021,
  238. 649621747167423523,
  239. 4818206049188692305,
  240. 2230815448876041069,
  241. 5034484793468406763,
  242. 754684519442805673,
  243. 214180290351070734,
  244. 7647214962273172849,
  245. 6701330857882848509,
  246. 2182219019195059976
  247. ],
  248. retiredRelationUids: const [],
  249. modelVersion: 5,
  250. modelVersionParserMinimum: 5,
  251. version: 1);
  252. final bindings = <Type, EntityDefinition>{
  253. Profile: EntityDefinition<Profile>(
  254. model: _entities[0],
  255. toOneRelations: (Profile object) => [],
  256. toManyRelations: (Profile object) => {},
  257. getId: (Profile object) => object.id,
  258. setId: (Profile object, int id) {
  259. object.id = id;
  260. },
  261. objectToFB: (Profile object, fb.Builder fbb) {
  262. fbb.startTable(8);
  263. fbb.addInt64(0, object.id);
  264. fbb.addInt64(1, object.theme);
  265. fbb.addBool(3, object.isLogin);
  266. fbb.addBool(6, object.isLogout);
  267. fbb.finish(fbb.endTable());
  268. return object.id;
  269. },
  270. objectFromFB: (Store store, ByteData fbData) {
  271. final buffer = fb.BufferContext(fbData);
  272. final rootOffset = buffer.derefObject(0);
  273. final object = Profile()
  274. ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
  275. ..theme = const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)
  276. ..isLogin =
  277. const fb.BoolReader().vTableGet(buffer, rootOffset, 10, false)
  278. ..isLogout =
  279. const fb.BoolReader().vTableGet(buffer, rootOffset, 16, false);
  280. return object;
  281. }),
  282. Content: EntityDefinition<Content>(
  283. model: _entities[1],
  284. toOneRelations: (Content object) => [],
  285. toManyRelations: (Content object) => {},
  286. getId: (Content object) => object.id,
  287. setId: (Content object, int id) {
  288. object.id = id;
  289. },
  290. objectToFB: (Content object, fb.Builder fbb) {
  291. fbb.startTable(2);
  292. fbb.addInt64(0, object.id);
  293. fbb.finish(fbb.endTable());
  294. return object.id;
  295. },
  296. objectFromFB: (Store store, ByteData fbData) {
  297. final buffer = fb.BufferContext(fbData);
  298. final rootOffset = buffer.derefObject(0);
  299. final object = Content()
  300. ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0);
  301. return object;
  302. }),
  303. Message: EntityDefinition<Message>(
  304. model: _entities[2],
  305. toOneRelations: (Message object) =>
  306. [object.from, object.to, object.content],
  307. toManyRelations: (Message object) => {},
  308. getId: (Message object) => object.id,
  309. setId: (Message object, int id) {
  310. object.id = id;
  311. },
  312. objectToFB: (Message object, fb.Builder fbb) {
  313. fbb.startTable(7);
  314. fbb.addInt64(0, object.id);
  315. fbb.addInt64(1, object.from.targetId);
  316. fbb.addInt64(2, object.to.targetId);
  317. fbb.addInt64(4, object.time);
  318. fbb.addInt64(5, object.content.targetId);
  319. fbb.finish(fbb.endTable());
  320. return object.id;
  321. },
  322. objectFromFB: (Store store, ByteData fbData) {
  323. final buffer = fb.BufferContext(fbData);
  324. final rootOffset = buffer.derefObject(0);
  325. final object = Message()
  326. ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
  327. ..time =
  328. const fb.Int64Reader().vTableGet(buffer, rootOffset, 12, 0);
  329. object.from.targetId =
  330. const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0);
  331. object.from.attach(store);
  332. object.to.targetId =
  333. const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0);
  334. object.to.attach(store);
  335. object.content.targetId =
  336. const fb.Int64Reader().vTableGet(buffer, rootOffset, 14, 0);
  337. object.content.attach(store);
  338. return object;
  339. }),
  340. User: EntityDefinition<User>(
  341. model: _entities[3],
  342. toOneRelations: (User object) => [],
  343. toManyRelations: (User object) => {
  344. RelInfo<User>.toMany(2, object.id): object.friends,
  345. RelInfo<User>.toMany(5, object.id): object.messages,
  346. RelInfo<User>.toMany(6, object.id): object.groupMessages
  347. },
  348. getId: (User object) => object.id,
  349. setId: (User object, int id) {
  350. object.id = id;
  351. },
  352. objectToFB: (User object, fb.Builder fbb) {
  353. final usernameOffset = fbb.writeString(object.username);
  354. fbb.startTable(7);
  355. fbb.addInt64(0, object.id);
  356. fbb.addOffset(2, usernameOffset);
  357. fbb.addBool(3, object.isDND);
  358. fbb.addBool(4, object.isStick);
  359. fbb.addBool(5, object.isSpecialAttention);
  360. fbb.finish(fbb.endTable());
  361. return object.id;
  362. },
  363. objectFromFB: (Store store, ByteData fbData) {
  364. final buffer = fb.BufferContext(fbData);
  365. final rootOffset = buffer.derefObject(0);
  366. final object = User(
  367. const fb.StringReader().vTableGet(buffer, rootOffset, 8, ''))
  368. ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
  369. ..isDND =
  370. const fb.BoolReader().vTableGet(buffer, rootOffset, 10, false)
  371. ..isStick =
  372. const fb.BoolReader().vTableGet(buffer, rootOffset, 12, false)
  373. ..isSpecialAttention =
  374. const fb.BoolReader().vTableGet(buffer, rootOffset, 14, false);
  375. InternalToManyAccess.setRelInfo(object.friends, store,
  376. RelInfo<User>.toMany(2, object.id), store.box<User>());
  377. InternalToManyAccess.setRelInfo(object.messages, store,
  378. RelInfo<User>.toMany(5, object.id), store.box<User>());
  379. InternalToManyAccess.setRelInfo(object.groupMessages, store,
  380. RelInfo<User>.toMany(6, object.id), store.box<User>());
  381. return object;
  382. }),
  383. Group: EntityDefinition<Group>(
  384. model: _entities[4],
  385. toOneRelations: (Group object) => [],
  386. toManyRelations: (Group object) => {
  387. RelInfo<Group>.toMany(3, object.id): object.members,
  388. RelInfo<Group>.toMany(4, object.id): object.messages
  389. },
  390. getId: (Group object) => object.id,
  391. setId: (Group object, int id) {
  392. object.id = id;
  393. },
  394. objectToFB: (Group object, fb.Builder fbb) {
  395. fbb.startTable(2);
  396. fbb.addInt64(0, object.id);
  397. fbb.finish(fbb.endTable());
  398. return object.id;
  399. },
  400. objectFromFB: (Store store, ByteData fbData) {
  401. final buffer = fb.BufferContext(fbData);
  402. final rootOffset = buffer.derefObject(0);
  403. final object = Group()
  404. ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0);
  405. InternalToManyAccess.setRelInfo(object.members, store,
  406. RelInfo<Group>.toMany(3, object.id), store.box<Group>());
  407. InternalToManyAccess.setRelInfo(object.messages, store,
  408. RelInfo<Group>.toMany(4, object.id), store.box<Group>());
  409. return object;
  410. }),
  411. GroupMessage: EntityDefinition<GroupMessage>(
  412. model: _entities[5],
  413. toOneRelations: (GroupMessage object) =>
  414. [object.from, object.to, object.content],
  415. toManyRelations: (GroupMessage object) => {},
  416. getId: (GroupMessage object) => object.id,
  417. setId: (GroupMessage object, int id) {
  418. object.id = id;
  419. },
  420. objectToFB: (GroupMessage object, fb.Builder fbb) {
  421. fbb.startTable(7);
  422. fbb.addInt64(0, object.id);
  423. fbb.addInt64(1, object.from.targetId);
  424. fbb.addInt64(2, object.to.targetId);
  425. fbb.addInt64(4, object.time);
  426. fbb.addInt64(5, object.content.targetId);
  427. fbb.finish(fbb.endTable());
  428. return object.id;
  429. },
  430. objectFromFB: (Store store, ByteData fbData) {
  431. final buffer = fb.BufferContext(fbData);
  432. final rootOffset = buffer.derefObject(0);
  433. final object = GroupMessage()
  434. ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
  435. ..time =
  436. const fb.Int64Reader().vTableGet(buffer, rootOffset, 12, 0);
  437. object.from.targetId =
  438. const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0);
  439. object.from.attach(store);
  440. object.to.targetId =
  441. const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0);
  442. object.to.attach(store);
  443. object.content.targetId =
  444. const fb.Int64Reader().vTableGet(buffer, rootOffset, 14, 0);
  445. object.content.attach(store);
  446. return object;
  447. })
  448. };
  449. return ModelDefinition(model, bindings);
  450. }
  451. /// [Profile] entity fields to define ObjectBox queries.
  452. class Profile_ {
  453. /// see [Profile.id]
  454. static final id = QueryIntegerProperty<Profile>(_entities[0].properties[0]);
  455. /// see [Profile.theme]
  456. static final theme =
  457. QueryIntegerProperty<Profile>(_entities[0].properties[1]);
  458. /// see [Profile.isLogin]
  459. static final isLogin =
  460. QueryBooleanProperty<Profile>(_entities[0].properties[2]);
  461. /// see [Profile.isLogout]
  462. static final isLogout =
  463. QueryBooleanProperty<Profile>(_entities[0].properties[3]);
  464. }
  465. /// [Content] entity fields to define ObjectBox queries.
  466. class Content_ {
  467. /// see [Content.id]
  468. static final id = QueryIntegerProperty<Content>(_entities[1].properties[0]);
  469. }
  470. /// [Message] entity fields to define ObjectBox queries.
  471. class Message_ {
  472. /// see [Message.id]
  473. static final id = QueryIntegerProperty<Message>(_entities[2].properties[0]);
  474. /// see [Message.from]
  475. static final from =
  476. QueryRelationToOne<Message, User>(_entities[2].properties[1]);
  477. /// see [Message.to]
  478. static final to =
  479. QueryRelationToOne<Message, User>(_entities[2].properties[2]);
  480. /// see [Message.time]
  481. static final time = QueryIntegerProperty<Message>(_entities[2].properties[3]);
  482. /// see [Message.content]
  483. static final content =
  484. QueryRelationToOne<Message, Content>(_entities[2].properties[4]);
  485. }
  486. /// [User] entity fields to define ObjectBox queries.
  487. class User_ {
  488. /// see [User.id]
  489. static final id = QueryIntegerProperty<User>(_entities[3].properties[0]);
  490. /// see [User.username]
  491. static final username = QueryStringProperty<User>(_entities[3].properties[1]);
  492. /// see [User.isDND]
  493. static final isDND = QueryBooleanProperty<User>(_entities[3].properties[2]);
  494. /// see [User.isStick]
  495. static final isStick = QueryBooleanProperty<User>(_entities[3].properties[3]);
  496. /// see [User.isSpecialAttention]
  497. static final isSpecialAttention =
  498. QueryBooleanProperty<User>(_entities[3].properties[4]);
  499. /// see [User.friends]
  500. static final friends =
  501. QueryRelationToMany<User, User>(_entities[3].relations[0]);
  502. /// see [User.messages]
  503. static final messages =
  504. QueryRelationToMany<User, Message>(_entities[3].relations[1]);
  505. /// see [User.groupMessages]
  506. static final groupMessages =
  507. QueryRelationToMany<User, GroupMessage>(_entities[3].relations[2]);
  508. }
  509. /// [Group] entity fields to define ObjectBox queries.
  510. class Group_ {
  511. /// see [Group.id]
  512. static final id = QueryIntegerProperty<Group>(_entities[4].properties[0]);
  513. /// see [Group.members]
  514. static final members =
  515. QueryRelationToMany<Group, User>(_entities[4].relations[0]);
  516. /// see [Group.messages]
  517. static final messages =
  518. QueryRelationToMany<Group, GroupMessage>(_entities[4].relations[1]);
  519. }
  520. /// [GroupMessage] entity fields to define ObjectBox queries.
  521. class GroupMessage_ {
  522. /// see [GroupMessage.id]
  523. static final id =
  524. QueryIntegerProperty<GroupMessage>(_entities[5].properties[0]);
  525. /// see [GroupMessage.from]
  526. static final from =
  527. QueryRelationToOne<GroupMessage, User>(_entities[5].properties[1]);
  528. /// see [GroupMessage.to]
  529. static final to =
  530. QueryRelationToOne<GroupMessage, Group>(_entities[5].properties[2]);
  531. /// see [GroupMessage.time]
  532. static final time =
  533. QueryIntegerProperty<GroupMessage>(_entities[5].properties[3]);
  534. /// see [GroupMessage.content]
  535. static final content =
  536. QueryRelationToOne<GroupMessage, Content>(_entities[5].properties[4]);
  537. }