// Build your project to run Sourcery and create current contents for this file // Generated using the ObjectBox Swift Generator — https://objectbox.io // DO NOT EDIT // swiftlint:disable all import ObjectBox import Foundation // MARK: - Entity metadata /// 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() modelBuilder.lastEntity(id: 0, uid: 0) 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