objectbox.g.dart 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 'entity/login.dart';
  9. export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
  10. final _entities = <ModelEntity>[
  11. ModelEntity(
  12. id: const IdUid(1, 3444477729893015694),
  13. name: 'User',
  14. lastPropertyId: const IdUid(2, 2305308568754167021),
  15. flags: 0,
  16. properties: <ModelProperty>[
  17. ModelProperty(
  18. id: const IdUid(1, 5463014948149082651),
  19. name: 'id',
  20. type: 6,
  21. flags: 1),
  22. ModelProperty(
  23. id: const IdUid(2, 2305308568754167021),
  24. name: 'username',
  25. type: 9,
  26. flags: 2080,
  27. indexId: const IdUid(1, 2185831944762227781))
  28. ],
  29. relations: <ModelRelation>[],
  30. backlinks: <ModelBacklink>[])
  31. ];
  32. /// Open an ObjectBox store with the model declared in this file.
  33. Future<Store> openStore(
  34. {String? directory,
  35. int? maxDBSizeInKB,
  36. int? fileMode,
  37. int? maxReaders,
  38. bool queriesCaseSensitiveDefault = true,
  39. String? macosApplicationGroup}) async =>
  40. Store(getObjectBoxModel(),
  41. directory: directory ?? (await defaultStoreDirectory()).path,
  42. maxDBSizeInKB: maxDBSizeInKB,
  43. fileMode: fileMode,
  44. maxReaders: maxReaders,
  45. queriesCaseSensitiveDefault: queriesCaseSensitiveDefault,
  46. macosApplicationGroup: macosApplicationGroup);
  47. /// ObjectBox model definition, pass it to [Store] - Store(getObjectBoxModel())
  48. ModelDefinition getObjectBoxModel() {
  49. final model = ModelInfo(
  50. entities: _entities,
  51. lastEntityId: const IdUid(1, 3444477729893015694),
  52. lastIndexId: const IdUid(1, 2185831944762227781),
  53. lastRelationId: const IdUid(0, 0),
  54. lastSequenceId: const IdUid(0, 0),
  55. retiredEntityUids: const [],
  56. retiredIndexUids: const [],
  57. retiredPropertyUids: const [],
  58. retiredRelationUids: const [],
  59. modelVersion: 5,
  60. modelVersionParserMinimum: 5,
  61. version: 1);
  62. final bindings = <Type, EntityDefinition>{
  63. Login: EntityDefinition<Login>(
  64. model: _entities[0],
  65. toOneRelations: (Login object) => [],
  66. toManyRelations: (Login object) => {},
  67. getId: (Login object) => object.id,
  68. setId: (Login object, int id) {
  69. object.id = id;
  70. },
  71. objectToFB: (Login object, fb.Builder fbb) {
  72. final usernameOffset = fbb.writeString(object.username);
  73. fbb.startTable(3);
  74. fbb.addInt64(0, object.id);
  75. fbb.addOffset(1, usernameOffset);
  76. fbb.finish(fbb.endTable());
  77. return object.id;
  78. },
  79. objectFromFB: (Store store, ByteData fbData) {
  80. final buffer = fb.BufferContext(fbData);
  81. final rootOffset = buffer.derefObject(0);
  82. final object = Login(
  83. username:
  84. const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''))
  85. ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0);
  86. return object;
  87. })
  88. };
  89. return ModelDefinition(model, bindings);
  90. }
  91. /// [Login] entity fields to define ObjectBox queries.
  92. class User_ {
  93. /// see [Login.id]
  94. static final id = QueryIntegerProperty<Login>(_entities[0].properties[0]);
  95. /// see [Login.username]
  96. static final username = QueryStringProperty<Login>(_entities[0].properties[1]);
  97. }