Skip to content

Commit

Permalink
Support "primarykeys" attribute
Browse files Browse the repository at this point in the history
It is used once :-)
  • Loading branch information
helje5 committed Oct 31, 2024
1 parent bac0903 commit f048f7e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Sources/ZeeQL/Access/ModelLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,8 @@ open class CoreDataModelLoader : ModelLoader {
* ### GetObjects tag
*
* Attributes (currently unsupported):
* ```
* version
* schema - String - the default schema
* ```
* - version
* - schema - String - the default schema
*
* Children:
* - `<entity>` tags
Expand Down Expand Up @@ -497,8 +495,15 @@ open class CoreDataModelLoader : ModelLoader {
if attr.name == "id" { idAttribute = attr }
}
if let pkeyName = attrs["primarykey"], !pkeyName.isEmpty { // GETobjects
assert(entity.primaryKeyAttributeNames == nil)
entity.primaryKeyAttributeNames = [ pkeyName ]
}
if let pkeyNames = attrs["primarykeys"]?.split(separator: ","),
!pkeyNames.isEmpty
{ // GETobjects
assert(entity.primaryKeyAttributeNames == nil)
entity.primaryKeyAttributeNames = pkeyNames.map(String.init)
}

var toManyRelships = [ ( ModelRelationship, XMLElement ) ]()
for rs in xml.childElementsWithName("relationship") {
Expand Down

0 comments on commit f048f7e

Please sign in to comment.