mirror of
https://github.com/metabolist/metatext.git
synced 2024-06-13 02:49:21 +00:00
21 lines
659 B
Swift
21 lines
659 B
Swift
|
// Copyright © 2021 Metabolist. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
|
import GRDB
|
||
|
import Mastodon
|
||
|
|
||
|
struct AccountAndRelationshipInfo: Codable, Hashable, FetchableRecord {
|
||
|
let accountInfo: AccountInfo
|
||
|
let relationship: Relationship?
|
||
|
}
|
||
|
|
||
|
extension AccountAndRelationshipInfo {
|
||
|
static func addingIncludes<T: DerivableRequest>(_ request: T) -> T where T.RowDecoder == AccountRecord {
|
||
|
AccountInfo.addingIncludes(request).including(optional: AccountRecord.relationship)
|
||
|
}
|
||
|
|
||
|
static func request(_ request: QueryInterfaceRequest<AccountRecord>) -> QueryInterfaceRequest<Self> {
|
||
|
addingIncludes(request).asRequest(of: self)
|
||
|
}
|
||
|
}
|