Skip to content

Commit

Permalink
Add support for restrictingQualifiers in models
Browse files Browse the repository at this point in the history
...
  • Loading branch information
helje5 committed Nov 11, 2024
1 parent f5cef91 commit b6a5e37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions Sources/ZeeQL/Access/CodeEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ open class CodeEntityBase : Entity {
public final var name : String = ""
public final var externalName : String?
public final var className : String? // TBD: Hm.
public final var restrictingQualifier : Qualifier?

public final var attributes = Array<ZeeQL.Attribute>()
public final var relationships = [ Relationship ]()
Expand Down Expand Up @@ -179,7 +180,8 @@ open class CodeObjectEntity<T: CodeObjectType> : CodeEntityBase {

// MARK: - Reflection

fileprivate let specialTableKey = "table"
fileprivate let specialTableKey = "table" // TBD
fileprivate let specialRestrictingQualifierKey = "_restrictingQualifier"

fileprivate extension CodeEntityBase {

Expand Down Expand Up @@ -209,7 +211,14 @@ fileprivate extension CodeEntityBase {
externalName = v
continue
}

if propname == specialRestrictingQualifierKey {
assert(propValue is Qualifier)
if let v = propValue as? Qualifier {
restrictingQualifier = v
continue
}
}

if let attribute = CodeAttributeFactory.attributeFor(property: propname,
value: propValue)
{
Expand Down
6 changes: 3 additions & 3 deletions Sources/ZeeQL/Access/ModelPattern.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ fileprivate extension ModelAttribute {
attrs.append(attr)
}
else {
globalZeeQLLogger.warn("Did not find column as name", columnName,
"in template", entity.name,
"in database:", inAttrs)
globalZeeQLLogger.warn("Did not find column w/ name", columnName,
"\n in template", entity.name,
"\n in database:", inAttrs)

}
}
Expand Down

0 comments on commit b6a5e37

Please sign in to comment.