// Generated using the ObjectBox Swift Generator — https://objectbox.io // DO NOT EDIT // swiftlint:disable all import ObjectBox import Foundation // MARK: - Entity metadata extension PlaybackTracking: ObjectBox.__EntityRelatable { internal typealias EntityType = PlaybackTracking internal var _id: EntityId { return EntityId(self.id.value) } } extension PlaybackTracking: ObjectBox.EntityInspectable { internal typealias EntityBindingType = PlaybackTrackingBinding /// Generated metadata used by ObjectBox to persist the entity. internal static var entityInfo = ObjectBox.EntityInfo(name: "PlaybackTracking", id: 1) internal static var entityBinding = EntityBindingType() fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { let entityBuilder = try modelBuilder.entityBuilder(for: PlaybackTracking.self, id: 1, uid: 1902306876074642688) try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 3822545071117514752) try entityBuilder.addProperty(name: "audioContentId", type: PropertyType.long, id: 2, uid: 6201823391120048640) try entityBuilder.addProperty(name: "totalDuration", type: PropertyType.long, id: 3, uid: 8353299921632812032) try entityBuilder.addProperty(name: "startPosition", type: PropertyType.long, id: 4, uid: 3188699482915899648) try entityBuilder.addProperty(name: "isFree", type: PropertyType.bool, id: 5, uid: 2487054984108217856) try entityBuilder.addProperty(name: "isPreview", type: PropertyType.bool, id: 6, uid: 5106135603734636032) try entityBuilder.addProperty(name: "endPosition", type: PropertyType.long, id: 7, uid: 8116657363890041600) try entityBuilder.addProperty(name: "playDateTime", type: PropertyType.string, id: 8, uid: 8837430652093702400) try entityBuilder.lastProperty(id: 8, uid: 8837430652093702400) } } extension PlaybackTracking { /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.id == myId } internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.audioContentId > 1234 } internal static var audioContentId: Property { return Property(propertyId: 2, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.totalDuration > 1234 } internal static var totalDuration: Property { return Property(propertyId: 3, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.startPosition > 1234 } internal static var startPosition: Property { return Property(propertyId: 4, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.isFree == true } internal static var isFree: Property { return Property(propertyId: 5, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.isPreview == true } internal static var isPreview: Property { return Property(propertyId: 6, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.endPosition > 1234 } internal static var endPosition: Property { return Property(propertyId: 7, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { PlaybackTracking.playDateTime.startsWith("X") } internal static var playDateTime: Property { return Property(propertyId: 8, isPrimaryKey: false) } fileprivate func __setId(identifier: ObjectBox.Id) { self.id = Id(identifier) } } extension ObjectBox.Property where E == PlaybackTracking { /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .id == myId } internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .audioContentId > 1234 } internal static var audioContentId: Property { return Property(propertyId: 2, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .totalDuration > 1234 } internal static var totalDuration: Property { return Property(propertyId: 3, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .startPosition > 1234 } internal static var startPosition: Property { return Property(propertyId: 4, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .isFree == true } internal static var isFree: Property { return Property(propertyId: 5, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .isPreview == true } internal static var isPreview: Property { return Property(propertyId: 6, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .endPosition > 1234 } internal static var endPosition: Property { return Property(propertyId: 7, isPrimaryKey: false) } /// Generated entity property information. /// /// You may want to use this in queries to specify fetch conditions, for example: /// /// box.query { .playDateTime.startsWith("X") } internal static var playDateTime: Property { return Property(propertyId: 8, isPrimaryKey: false) } } /// Generated service type to handle persisting and reading entity data. Exposed through `PlaybackTracking.EntityBindingType`. internal class PlaybackTrackingBinding: ObjectBox.EntityBinding { internal typealias EntityType = PlaybackTracking internal typealias IdType = Id internal required init() {} internal func generatorBindingVersion() -> Int { 1 } internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) { entity.__setId(identifier: entityId) } internal func entityId(of entity: EntityType) -> ObjectBox.Id { return entity.id.value } internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { let propertyOffset_playDateTime = propertyCollector.prepare(string: entity.playDateTime) propertyCollector.collect(id, at: 2 + 2 * 1) propertyCollector.collect(entity.audioContentId, at: 2 + 2 * 2) propertyCollector.collect(entity.totalDuration, at: 2 + 2 * 3) propertyCollector.collect(entity.startPosition, at: 2 + 2 * 4) propertyCollector.collect(entity.isFree, at: 2 + 2 * 5) propertyCollector.collect(entity.isPreview, at: 2 + 2 * 6) propertyCollector.collect(entity.endPosition, at: 2 + 2 * 7) propertyCollector.collect(dataOffset: propertyOffset_playDateTime, at: 2 + 2 * 8) } internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { let entity = PlaybackTracking() entity.id = entityReader.read(at: 2 + 2 * 1) entity.audioContentId = entityReader.read(at: 2 + 2 * 2) entity.totalDuration = entityReader.read(at: 2 + 2 * 3) entity.startPosition = entityReader.read(at: 2 + 2 * 4) entity.isFree = entityReader.read(at: 2 + 2 * 5) entity.isPreview = entityReader.read(at: 2 + 2 * 6) entity.endPosition = entityReader.read(at: 2 + 2 * 7) entity.playDateTime = entityReader.read(at: 2 + 2 * 8) return entity } } /// Helper function that allows calling Enum(rawValue: value) with a nil value, which will return nil. fileprivate func optConstruct(_ type: T.Type, rawValue: T.RawValue?) -> T? { guard let rawValue = rawValue else { return nil } return T(rawValue: rawValue) } // MARK: - Store setup fileprivate func cModel() throws -> OpaquePointer { let modelBuilder = try ObjectBox.ModelBuilder() try PlaybackTracking.buildEntity(modelBuilder: modelBuilder) modelBuilder.lastEntity(id: 1, uid: 1902306876074642688) return modelBuilder.finish() } extension ObjectBox.Store { /// A store with a fully configured model. Created by the code generator with your model's metadata in place. /// /// - Parameters: /// - directoryPath: The directory path in which ObjectBox places its database files for this store. /// - maxDbSizeInKByte: Limit of on-disk space for the database files. Default is `1024 * 1024` (1 GiB). /// - fileMode: UNIX-style bit mask used for the database files; default is `0o644`. /// Note: directories become searchable if the "read" or "write" permission is set (e.g. 0640 becomes 0750). /// - maxReaders: The maximum number of readers. /// "Readers" are a finite resource for which we need to define a maximum number upfront. /// The default value is enough for most apps and usually you can ignore it completely. /// However, if you get the maxReadersExceeded error, you should verify your /// threading. For each thread, ObjectBox uses multiple readers. Their number (per thread) depends /// on number of types, relations, and usage patterns. Thus, if you are working with many threads /// (e.g. in a server-like scenario), it can make sense to increase the maximum number of readers. /// Note: The internal default is currently around 120. /// So when hitting this limit, try values around 200-500. /// - important: This initializer is created by the code generator. If you only see the internal `init(model:...)` /// initializer, trigger code generation by building your project. internal convenience init(directoryPath: String, maxDbSizeInKByte: UInt64 = 1024 * 1024, fileMode: UInt32 = 0o644, maxReaders: UInt32 = 0, readOnly: Bool = false) throws { try self.init( model: try cModel(), directory: directoryPath, maxDbSizeInKByte: maxDbSizeInKByte, fileMode: fileMode, maxReaders: maxReaders, readOnly: readOnly) } } // swiftlint:enable all