Skip to content

Commit

Permalink
adapt Sendable protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
sudopark committed Aug 8, 2022
1 parent be79b22 commit e2997a0
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Sources/SQLiteService/Core/Query+Builder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - QueryBuilder

public struct QueryBuilder {
public struct QueryBuilder: @unchecked Sendable {

var conditions: QueryExpression.ConditionSet = .empty
var ascendings: [ColumnName] = []
Expand Down Expand Up @@ -74,7 +74,7 @@ extension QueryBuilder {

// MARK: - QueryBuilable

public protocol QueryBuilable {
public protocol QueryBuilable: Sendable {

var builder: QueryBuilder { get set }
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/SQLiteService/Core/Query+Expression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension QueryExpression {

extension QueryExpression {

public struct Condition {
public struct Condition: Sendable {

enum Operator {
case isNull
Expand All @@ -58,7 +58,7 @@ extension QueryExpression {
let value: ScalarType?
}

public indirect enum ConditionSet {
public indirect enum ConditionSet: Sendable {
case empty
case single(_ condition: Condition)
case and(_ left: ConditionSet, _ right: ConditionSet, capsuled: Bool)
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLiteService/Core/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation


public protocol Query {
public protocol Query: Sendable {

@discardableResult
func `where`(_ conditions: QueryExpression.Condition) -> Self
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLiteService/Core/ScalarType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

// MARK: - ScalarType

public protocol ScalarType { }
public protocol ScalarType: Sendable { }

extension Bool: ScalarType {

Expand Down
4 changes: 2 additions & 2 deletions Sources/SQLiteService/Queries/Query+Join.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Foundation

// MARK: - JoinExpression

enum JoinExpression {
enum JoinExpression: Sendable {

enum Method: String {
enum Method: String, Sendable {
case inner = "INNER"
case outer = "LEFT OUTER"
case cross = "CROSS"
Expand Down
6 changes: 3 additions & 3 deletions Sources/SQLiteService/SQLiteDataBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SQLite3

// MARK: - DataBase

public protocol DataBase {
public protocol DataBase: Sendable {

func userVersion() throws -> Int32

Expand Down Expand Up @@ -86,7 +86,7 @@ extension DataBase {

// MARK: - Connection

public protocol Connection {
public protocol Connection: Sendable {

func open(path: String) throws

Expand All @@ -96,7 +96,7 @@ public protocol Connection {

// MARK: - SQLiteDataBase

public class SQLiteDataBase: Connection, DataBase {
public final class SQLiteDataBase: Connection, DataBase, @unchecked Sendable {

private var dbPointer: OpaquePointer?

Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLiteService/SQLiteService+Concurrency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
@available(iOS 13.0.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
public extension SQLiteService {

struct Concurrency {
struct Concurrency: Sendable {
private let sqlteService: SQLiteService

init(_ service: SQLiteService) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLiteService/SQLiteService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private extension DispatchQueue {
}


public class SQLiteService {
public final class SQLiteService: @unchecked Sendable {

private let dbConnection: Connection & DataBase
private let serialAccessQueue: DispatchQueue
Expand Down
4 changes: 2 additions & 2 deletions Sources/SQLiteService/Table/Table+Column.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

// MARK: - ColumnDataAttribute

public enum ColumnDataAttribute {
public enum ColumnDataAttribute: Sendable {

case primaryKey(autoIncrement: Bool)
case notNull
Expand Down Expand Up @@ -85,7 +85,7 @@ public enum ColumnDataType {

// MARK: - TableColumn

public protocol TableColumn: RawRepresentable, CaseIterable where RawValue == String {
public protocol TableColumn: Sendable, RawRepresentable, CaseIterable where RawValue == String {

var dataType: ColumnDataType { get }
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLiteService/Table/Table.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SQLite3

// MARK: - Table

public protocol Table {
public protocol Table: Sendable {

associatedtype EntityType: RowValueType
associatedtype ColumnType: TableColumn
Expand Down

0 comments on commit e2997a0

Please sign in to comment.