0001 // Result.swift 0002 // 0003 // The MIT License (MIT) 0004 // 0005 // Copyright (c) 2015 Formbound 0006 // 0007 // Permission is hereby granted, free of charge, to any person obtaining a copy 0008 // of this software and associated documentation files (the "Software"), to deal 0009 // in the Software without restriction, including without limitation the rights 0010 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 0011 // copies of the Software, and to permit persons to whom the Software is 0012 // furnished to do so, subject to the following conditions: 0013 // 0014 // The above copyright notice and this permission notice shall be included in all 0015 // copies or substantial portions of the Software. 0016 // 0017 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0018 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0019 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0020 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0021 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 0022 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 0023 // SOFTWARE. 0024 0025 public protocol ResultStatus { 0026 var successful: Bool { get } 0027 } 0028 0029 public protocol Result: CollectionType { 0030 associatedtype FieldType
Result.swift:64 extension Result {: Field 0031 associatedtype Generator
Result.swift:36 var fields: [FieldType] { get }: RowGeneratorType = RowGenerator 0032 0033 0034 func clear() 0035 0036 var fields: [FieldType] { get } 0037 0038 subscript
Query.swift:233 public func fetch<T: Connection where T.ResultType.Generator.Element == Row>(connection: T) throws -> [ModelType] {Query.swift:237 public func first<T: Connection where T.ResultType.Generator.Element == Row>(connection: T) throws -> ModelType? {(index: Int) -> Row { get } 0039 0040 var count
Result.swift:73 let row = self[index]: Int { get } 0041 } 0042 0043 public protocol RowGeneratorType
Result.swift:69 if index < 0 || index >= self.count {Result.swift:84 return count: GeneratorType { 0044 associatedtype Element: RowType 0045 0046 func next() -> Row? 0047 } 0048 0049 public struct RowGenerator
Result.swift:49 public struct RowGenerator: RowGeneratorType {: RowGeneratorType { 0050 public typealias Element
Result.swift:66 public func generate() -> RowGenerator {Result.swift:68 return RowGenerator {= Row 0051 0052 let block
Result.swift:52 let block: Void -> Element?Result.swift:55 init(block: Void -> Element?) {Result.swift:59 public func next() -> Element? {: Void -> Element? 0053 var index: Int = 0 0054 0055 init
Result.swift:56 self.block = blockResult.swift:60 return block()(block: Void -> Element?) { 0056 self.block = block 0057 } 0058 0059 public func next() -> Element? { 0060 return block() 0061 } 0062 } 0063 0064 extension Result { 0065 0066 public func generate() -> RowGenerator { 0067 var index = 0 0068 return RowGenerator { 0069 if index < 0 || index >= self.count { 0070 return nil 0071 } 0072 0073 let row = self[index] 0074 index += 1 0075 return row 0076 } 0077 } 0078 0079 public var startIndex: Int { 0080 return 0 0081 } 0082 0083 public var endIndex: Int { 0084 return count 0085 } 0086 }
Result.swift:68 return RowGenerator {