DataLiteCore swift package

This commit is contained in:
2025-04-24 23:48:46 +03:00
parent b0e52a72b7
commit 6f955b2c43
70 changed files with 7939 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
import Foundation
public extension SQLiteRawBindable where Self: RawRepresentable, RawValue: SQLiteRawBindable {
/// Provides the `SQLiteRawValue` representation for `RawRepresentable` types.
///
/// This implementation converts the `RawRepresentable` type's `rawValue` to its corresponding
/// `SQLiteRawValue` representation. The `rawValue` itself must conform to `SQLiteRawBindable`.
///
/// - Returns: An `SQLiteRawValue` representation of the `RawRepresentable` type.
var sqliteRawValue: SQLiteRawValue {
rawValue.sqliteRawValue
}
}
public extension SQLiteRawRepresentable where Self: RawRepresentable, RawValue: SQLiteRawRepresentable {
/// Initializes an instance of the conforming type from an `SQLiteRawValue`.
///
/// This initializer converts the `SQLiteRawValue` to the `RawRepresentable` type's `rawValue`.
/// It first attempts to create a `RawValue` from the `SQLiteRawValue`, then uses that to initialize
/// the `RawRepresentable` instance. If the `SQLiteRawValue` cannot be converted to the `RawValue`, the
/// initializer returns `nil`.
///
/// - Parameter sqliteRawValue: The raw SQLite value used to initialize the instance.
init?(_ sqliteRawValue: SQLiteRawValue) {
if let value = RawValue(sqliteRawValue) {
self.init(rawValue: value)
} else {
return nil
}
}
}