Skip to content

Commit

Permalink
4.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Mar 17, 2024
1 parent e80a2eb commit 06daaa0
Show file tree
Hide file tree
Showing 9 changed files with 745 additions and 748 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ import PackageDescription
let package = Package(
name: "SomeProject",
dependencies: [
.package(url: "https://github.com/dankinsoid/VDFlow.git", from: "4.21.0")
.package(url: "https://github.com/dankinsoid/VDFlow.git", from: "4.22.0")
],
targets: [
.target(name: "SomeProject", dependencies: ["VDFlow"])
Expand Down
29 changes: 14 additions & 15 deletions Sources/VDFlow/MutateID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,28 @@ import Foundation

public struct MutateID: Comparable, Hashable, Codable, Sendable {

var mutationDate: UInt64?
var mutationDate: UInt64?

public init() {
public init() {}

public init(from decoder: Decoder) throws {
let date = try UInt64(from: decoder)
mutationDate = date == 0 ? nil : date
}

public init(from decoder: Decoder) throws {
let date = try UInt64(from: decoder)
mutationDate = date == 0 ? nil : date
}

public func encode(to encoder: Encoder) throws {
try (mutationDate ?? 0).encode(to: encoder)
}
public func encode(to encoder: Encoder) throws {
try (mutationDate ?? 0).encode(to: encoder)
}

public mutating func _update() {
mutationDate = DispatchTime.now().uptimeNanoseconds
mutationDate = DispatchTime.now().uptimeNanoseconds
}

public static func < (lhs: MutateID, rhs: MutateID) -> Bool {
(lhs.mutationDate ?? 0) < (rhs.mutationDate ?? 0)
}
var optional: MutateID? {
mutationDate.map { _ in self }
}

var optional: MutateID? {
mutationDate.map { _ in self }
}
}
Loading

0 comments on commit 06daaa0

Please sign in to comment.