Skip to content

Commit

Permalink
Minor improv to datasource accessor
Browse files Browse the repository at this point in the history
If the type is known, this will work:
```swift
let personDS: OGoPersonDataSource = db.datasource()
```
  • Loading branch information
helje5 committed Nov 10, 2024
1 parent cf2a6ea commit f5cef91
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Sources/ZeeQL/Access/ActiveDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ZeeQL
//
// Created by Helge Hess on 27/02/17.
// Copyright © 2017 ZeeZide GmbH. All rights reserved.
// Copyright © 2017-2024 ZeeZide GmbH. All rights reserved.
//

/**
Expand Down Expand Up @@ -211,9 +211,10 @@ fileprivate let countAttr : Attribute = {

public extension Database {

func datasource<Object>(_ type: Object.Type) -> ActiveDataSource<Object> {
// use type argument to capture, is there a nicer way?
@inlinable
func datasource<Object>(_ type: Object.Type = Object.self)
-> ActiveDataSource<Object>
{
return ActiveDataSource<Object>(database: self)
}

}

0 comments on commit f5cef91

Please sign in to comment.