DataLireCoder swift package
This commit is contained in:
6
Sources/DLCDecoder/Protocols/Container.swift
Normal file
6
Sources/DLCDecoder/Protocols/Container.swift
Normal file
@@ -0,0 +1,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol Container {
|
||||
associatedtype Decoder: Swift.Decoder
|
||||
var decoder: Decoder { get }
|
||||
}
|
||||
6
Sources/DLCDecoder/Protocols/DateDecoder.swift
Normal file
6
Sources/DLCDecoder/Protocols/DateDecoder.swift
Normal file
@@ -0,0 +1,6 @@
|
||||
import Foundation
|
||||
|
||||
public protocol DateDecoder {
|
||||
func decode(from decoder: any ValueDecoder) throws -> Date
|
||||
func decode(from decoder: any RowDecoder, for key: any CodingKey) throws -> Date
|
||||
}
|
||||
8
Sources/DLCDecoder/Protocols/Decoder.swift
Normal file
8
Sources/DLCDecoder/Protocols/Decoder.swift
Normal file
@@ -0,0 +1,8 @@
|
||||
import Foundation
|
||||
|
||||
public protocol Decoder: Swift.Decoder {
|
||||
associatedtype SQLiteData
|
||||
|
||||
var dateDecoder: any DateDecoder { get }
|
||||
var sqliteData: SQLiteData { get }
|
||||
}
|
||||
5
Sources/DLCDecoder/Protocols/KeyCheckingDecoder.swift
Normal file
5
Sources/DLCDecoder/Protocols/KeyCheckingDecoder.swift
Normal file
@@ -0,0 +1,5 @@
|
||||
import Foundation
|
||||
|
||||
public protocol KeyCheckingDecoder: Decoder {
|
||||
func contains(_ key: CodingKey) -> Bool
|
||||
}
|
||||
11
Sources/DLCDecoder/Protocols/RowDecoder.swift
Normal file
11
Sources/DLCDecoder/Protocols/RowDecoder.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
import Foundation
|
||||
import DataLiteCore
|
||||
|
||||
public protocol RowDecoder: Decoder {
|
||||
var count: Int? { get }
|
||||
|
||||
func decodeNil(for key: CodingKey) throws -> Bool
|
||||
func decodeDate(for key: CodingKey) throws -> Date
|
||||
func decode<T: SQLiteRawRepresentable>(_ type: T.Type, for key: CodingKey) throws -> T
|
||||
func decoder(for key: CodingKey) throws -> any Decoder
|
||||
}
|
||||
8
Sources/DLCDecoder/Protocols/ValueDecoder.swift
Normal file
8
Sources/DLCDecoder/Protocols/ValueDecoder.swift
Normal file
@@ -0,0 +1,8 @@
|
||||
import Foundation
|
||||
import DataLiteCore
|
||||
|
||||
public protocol ValueDecoder: Decoder {
|
||||
func decodeNil() -> Bool
|
||||
func decodeDate() throws -> Date
|
||||
func decode<T: SQLiteRawRepresentable>(_ type: T.Type) throws -> T
|
||||
}
|
||||
Reference in New Issue
Block a user