Skip to content

Commit

Permalink
VergeTypedIdentifier (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Mar 22, 2024
1 parent 35772f6 commit 204d6fb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ let package = Package(
"VergeRx"
]
),
.target(name: "VergeTypedIdentifier"),
.target(
name: "VergeNormalization",
dependencies: [
"VergeMacros",
"VergeComparator",
"VergeTypedIdentifier",
.product(name: "HashTreeCollections", package: "swift-collections"),
]
),
Expand Down
1 change: 1 addition & 0 deletions Sources/VergeNormalization/Tables/TableType.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import VergeTypedIdentifier

/// a storage of the entity
public protocol TableType<Entity>: Equatable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/VergeNormalization/VergeNormalization.swift
Original file line number Diff line number Diff line change
@@ -1 +1 @@

@_exported import VergeTypedIdentifier
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,11 @@ public protocol EntityType: Equatable, Sendable {

associatedtype EntityIDRawType: _PrimitiveIdentifierConvertible

static var entityName: EntityTableIdentifier { get }

var entityID: EntityID { get }

typealias EntityID = EntityIdentifier<Self>
}

extension EntityType {

/// Returns EntityName from reflection
///
/// - Warning:
/// Taking the name in runtime, it's not fast.
/// To be faster, override this property each your entities.
public static var entityName: EntityTableIdentifier {
.init(Self.self)
}

}

public struct EntityTableIdentifier: Hashable {

public let name: String
Expand Down

0 comments on commit 204d6fb

Please sign in to comment.