diff --git a/Documentation/WhyAdoptGRDB.md b/Documentation/WhyAdoptGRDB.md index cb51bf465..29ecf731a 100644 --- a/Documentation/WhyAdoptGRDB.md +++ b/Documentation/WhyAdoptGRDB.md @@ -72,10 +72,10 @@ extension Place: DecodableRecord { ... } let places = try Place.fetchAll(db, "SELECT * FROM places") // [Place] ``` -Add the [TableMapping] protocol, and SQL requests are generated for you: +Add the [TableRecord] protocol, and SQL requests are generated for you: ```swift -extension Place: TableMapping { ... } +extension Place: TableRecord { ... } let place = try Place.fetchOne(db, key: 1) // Place? ``` @@ -271,5 +271,5 @@ Happy GRDB! :gift: [SQLite.swift]: http://github.com/stephencelis/SQLite.swift [StORM]: https://www.perfect.org/docs/StORM.html [Swift-Kuery]: http://github.com/IBM-Swift/Swift-Kuery -[TableMapping]: https://github.com/groue/GRDB.swift/blob/master/README.md#records +[TableRecord]: https://github.com/groue/GRDB.swift/blob/master/README.md#records [TransactionObserver]: https://github.com/groue/GRDB.swift/blob/master/README.md#transactionobserver-protocol diff --git a/GRDB.xcodeproj/project.pbxproj b/GRDB.xcodeproj/project.pbxproj index 910714da5..18b21cf1d 100755 --- a/GRDB.xcodeproj/project.pbxproj +++ b/GRDB.xcodeproj/project.pbxproj @@ -47,8 +47,8 @@ 560D92431C672C3E00F4F92B /* StatementColumnConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D923F1C672C3E00F4F92B /* StatementColumnConvertible.swift */; }; 560D92471C672C4B00F4F92B /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92441C672C4B00F4F92B /* Persistable.swift */; }; 560D92481C672C4B00F4F92B /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92441C672C4B00F4F92B /* Persistable.swift */; }; - 560D924B1C672C4B00F4F92B /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; - 560D924C1C672C4B00F4F92B /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; + 560D924B1C672C4B00F4F92B /* TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableRecord.swift */; }; + 560D924C1C672C4B00F4F92B /* TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableRecord.swift */; }; 561667051D08A49900ADD404 /* FoundationNSDecimalNumberTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561667001D08A49900ADD404 /* FoundationNSDecimalNumberTests.swift */; }; 56176C591EACCCC7000F3F2B /* FTS5CustomTokenizerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5698AD001DAA8ACA0056AF8C /* FTS5CustomTokenizerTests.swift */; }; 56176C5A1EACCCC7000F3F2B /* FTS5PatternTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B964C01DA521450002DA19 /* FTS5PatternTests.swift */; }; @@ -97,7 +97,7 @@ 56300B5F1C53C38F005A543B /* QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */; }; 56300B621C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B601C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift */; }; 56300B691C53D25E005A543B /* QueryInterfaceExpressionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */; }; - 56300B6C1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + 56300B6C1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; 56300B781C53F592005A543B /* QueryInterfaceRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6F1C53F592005A543B /* QueryInterfaceRequest.swift */; }; 56300B791C53F592005A543B /* QueryInterfaceRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6F1C53F592005A543B /* QueryInterfaceRequest.swift */; }; 56300B861C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */; }; @@ -185,7 +185,7 @@ 565490E01D5AE252005622CB /* FetchedRecordsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A7787C1C6A4DD600F507F6 /* FetchedRecordsController.swift */; }; 565490E11D5AE252005622CB /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92441C672C4B00F4F92B /* Persistable.swift */; }; 565490E21D5AE252005622CB /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238A11B9C753B0082EB20 /* Record.swift */; }; - 565490E41D5AE252005622CB /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; + 565490E41D5AE252005622CB /* TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableRecord.swift */; }; 56553C101C3E906C00522B5C /* GRDBTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5623E0901B4AFACC00B20B7F /* GRDBTestCase.swift */; }; 56553C131C3E906C00522B5C /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC3773F319C8CBB3004FCF85 /* GRDB.framework */; }; 5657AAB91D107001006283EF /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5657AAB81D107001006283EF /* NSData.swift */; }; @@ -515,7 +515,7 @@ 56D496671D813086008276D7 /* Record+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */; }; 56D496681D813086008276D7 /* DecodableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B601C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift */; }; 56D496691D813086008276D7 /* QueryInterfaceExpressionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */; }; - 56D4966A1D813086008276D7 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + 56D4966A1D813086008276D7 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; 56D4966B1D81309E008276D7 /* MutablePersistableDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */; }; 56D4966C1D81309E008276D7 /* RecordMinimalPrimaryKeyRowIDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238261B9C74A90082EB20 /* RecordMinimalPrimaryKeyRowIDTests.swift */; }; 56D4966D1D81309E008276D7 /* RecordMinimalPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238271B9C74A90082EB20 /* RecordMinimalPrimaryKeySingleTests.swift */; }; @@ -577,9 +577,9 @@ 56D507621F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */; }; 56D507831F6D7B2E00AE1C5B /* InsertRecordStructTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */; }; 56D507841F6D7B2F00AE1C5B /* InsertRecordStructTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */; }; - 56D51D001EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */; }; - 56D51D031EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */; }; - 56D51D061EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */; }; + 56D51D001EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */; }; + 56D51D031EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */; }; + 56D51D061EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */; }; 56DAA2D21DE99DAB006E10C8 /* DatabaseCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */; }; 56DAA2D61DE99DAB006E10C8 /* DatabaseCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */; }; 56DAA2DB1DE9C827006E10C8 /* Cursor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2DA1DE9C827006E10C8 /* Cursor.swift */; }; @@ -620,8 +620,8 @@ 56FC987B1D969DEF00E3C842 /* SQLExpression+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */; }; 56FC987E1D969DEF00E3C842 /* SQLExpression+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */; }; 56FDECE31BB32DFD009AD709 /* RowFromStatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */; }; - 56FEE7FB1F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; - 56FEE7FF1F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; + 56FEE7FB1F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; + 56FEE7FF1F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; 56FF45441D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */; }; 56FF455A1D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF45551D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift */; }; 6340BF801E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6340BF7F1E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift */; }; @@ -768,7 +768,7 @@ 560D923E1C672C3E00F4F92B /* DatabaseValueConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConvertible.swift; sourceTree = ""; }; 560D923F1C672C3E00F4F92B /* StatementColumnConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementColumnConvertible.swift; sourceTree = ""; }; 560D92441C672C4B00F4F92B /* Persistable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistable.swift; sourceTree = ""; }; - 560D92461C672C4B00F4F92B /* TableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableMapping.swift; sourceTree = ""; }; + 560D92461C672C4B00F4F92B /* TableRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRecord.swift; sourceTree = ""; }; 560FC5101CAEEDF10014AA8E /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 561667001D08A49900ADD404 /* FoundationNSDecimalNumberTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationNSDecimalNumberTests.swift; sourceTree = ""; }; 562393171DECC02000A6B01F /* RowFetchTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFetchTests.swift; sourceTree = ""; }; @@ -785,7 +785,7 @@ 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceRequestTests.swift; sourceTree = ""; }; 56300B601C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceExpressionsTests.swift; sourceTree = ""; }; - 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TableMapping+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; + 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TableRecord+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 56300B6F1C53F592005A543B /* QueryInterfaceRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceRequest.swift; sourceTree = ""; }; 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Record+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 563363A91C933FF8000BE133 /* MutablePersistableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableTests.swift; sourceTree = ""; }; @@ -997,7 +997,7 @@ 56D3BE701F4EB1900034C6D2 /* FetchRecordStructTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchRecordStructTests.swift; sourceTree = ""; }; 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryKeyInfoTests.swift; sourceTree = ""; }; 56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsertRecordStructTests.swift; sourceTree = ""; }; - 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+TableMapping.swift"; sourceTree = ""; }; + 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+TableRecord.swift"; sourceTree = ""; }; 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCursorTests.swift; sourceTree = ""; }; 56DAA2DA1DE9C827006E10C8 /* Cursor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cursor.swift; sourceTree = ""; }; 56DE7B101C3D93ED00861EB8 /* StatementArgumentsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementArgumentsTests.swift; sourceTree = ""; }; @@ -1025,7 +1025,7 @@ 56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.101.1.swift"; sourceTree = ""; }; 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SQLExpression+QueryInterface.swift"; sourceTree = ""; }; 56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromStatementTests.swift; sourceTree = ""; }; - 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableMappingTests.swift; sourceTree = ""; }; + 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableRecordTests.swift; sourceTree = ""; }; 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableDeleteTests.swift; sourceTree = ""; }; 56FF45551D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordUniqueIndexTests.swift; sourceTree = ""; }; 6340BF7F1E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordPersistenceConflictPolicy.swift; sourceTree = ""; }; @@ -1203,12 +1203,12 @@ path = GRDBTests; sourceTree = ""; }; - 56176C9C1EACEA8C000F3F2B /* TableMapping */ = { + 56176C9C1EACEA8C000F3F2B /* TableRecord */ = { isa = PBXGroup; children = ( - 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */, + 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */, ); - name = TableMapping; + name = TableRecord; sourceTree = ""; }; 56176C9E1EACEDF9000F3F2B /* Record */ = { @@ -1267,7 +1267,7 @@ 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */, 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */, 566AD8C51D531BE4002EC1A8 /* TableDefinitionTests.swift */, - 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */, + 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */, 5698AC7F1DA380A20056AF8C /* VirtualTableModuleTests.swift */, ); name = QueryInterface; @@ -1497,7 +1497,7 @@ 560B3FA41C19DFF800C58EC7 /* Persistable */, 56176C9E1EACEDF9000F3F2B /* Record */, 5680520F201320E600E87861 /* RecordBoxTests.swift */, - 56176C9C1EACEA8C000F3F2B /* TableMapping */, + 56176C9C1EACEA8C000F3F2B /* TableRecord */, ); name = Record; sourceTree = ""; @@ -1550,13 +1550,13 @@ children = ( 56CEB4F01EAA2EFA00BFAF62 /* DecodableRecord.swift */, 5674A6F21F307F600095F066 /* DecodableRecord+Decodable.swift */, - 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */, + 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */, 31A7787C1C6A4DD600F507F6 /* FetchedRecordsController.swift */, 560D92441C672C4B00F4F92B /* Persistable.swift */, 5674A6F31F307F600095F066 /* Persistable+Encodable.swift */, 56A238A11B9C753B0082EB20 /* Record.swift */, 567517C720131B220094BF41 /* RecordBox.swift */, - 560D92461C672C4B00F4F92B /* TableMapping.swift */, + 560D92461C672C4B00F4F92B /* TableRecord.swift */, ); path = Record; sourceTree = ""; @@ -2170,9 +2170,9 @@ files = ( 569A98EF2039B6F3008D7DBF /* Fixits-3.0.swift in Sources */, 56B964BF1DA51D0A0002DA19 /* FTS5Pattern.swift in Sources */, - 56D51D061EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */, + 56D51D061EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */, 565490CE1D5AE252005622CB /* NSNull.swift in Sources */, - 565490E41D5AE252005622CB /* TableMapping.swift in Sources */, + 565490E41D5AE252005622CB /* TableRecord.swift in Sources */, 565490CF1D5AE252005622CB /* NSNumber.swift in Sources */, 566475C01D981AD200FF74B8 /* SQLSpecificExpressible+QueryInterface.swift in Sources */, 56CEB51F1EAA328900BFAF62 /* FTS5+QueryInterface.swift in Sources */, @@ -2328,8 +2328,8 @@ 566475BD1D981AD200FF74B8 /* SQLSpecificExpressible+QueryInterface.swift in Sources */, 56A238A51B9C753B0082EB20 /* Record.swift in Sources */, 5671FC231DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */, - 56D51D031EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */, - 560D924C1C672C4B00F4F92B /* TableMapping.swift in Sources */, + 56D51D031EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */, + 560D924C1C672C4B00F4F92B /* TableRecord.swift in Sources */, 567517C920131B220094BF41 /* RecordBox.swift in Sources */, 5657AB121D10899D006283EF /* URL.swift in Sources */, 5659F48B1EA8D94E004A4992 /* Utils.swift in Sources */, @@ -2468,7 +2468,7 @@ 5674A72D1F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, 566A84412041914000E50BFD /* MutablePersistableChangesTests.swift in Sources */, 56176C701EACCCC9000F3F2B /* FTS5WrapperTokenizerTests.swift in Sources */, - 56FEE7FF1F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE7FF1F47253700D930EA /* TableRecordTests.swift in Sources */, 56A2386A1B9C74A90082EB20 /* RecordSubClassTests.swift in Sources */, 56A2383E1B9C74A90082EB20 /* DatabaseValueTests.swift in Sources */, 567156181CB142AA007DC145 /* DatabaseQueueReadOnlyTests.swift in Sources */, @@ -2510,7 +2510,7 @@ 5623931C1DECC02000A6B01F /* RowFetchTests.swift in Sources */, 562393641DEE06D300A6B01F /* CursorTests.swift in Sources */, 5657AB5A1D108BA9006283EF /* FoundationNSStringTests.swift in Sources */, - 56300B6C1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + 56300B6C1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, 5674A7231F30A8DF0095F066 /* MutablePersistableEncodableTests.swift in Sources */, 56F0B9921B6001C600A2F135 /* FoundationNSDateTests.swift in Sources */, 56A238381B9C74A90082EB20 /* DatabaseTests.swift in Sources */, @@ -2616,7 +2616,7 @@ 5674A72A1F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, 566A84402041914000E50BFD /* MutablePersistableChangesTests.swift in Sources */, 56176C5E1EACCCC7000F3F2B /* FTS5WrapperTokenizerTests.swift in Sources */, - 56FEE7FB1F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE7FB1F47253700D930EA /* TableRecordTests.swift in Sources */, 56D496641D81304E008276D7 /* FoundationUUIDTests.swift in Sources */, 56D496921D81316E008276D7 /* RowFromDictionaryLiteralTests.swift in Sources */, 562206081E420EA4005860AC /* DatabasePoolReadOnlyTests.swift in Sources */, @@ -2660,7 +2660,7 @@ 56D496941D81317B008276D7 /* SchedulingWatchdogTests.swift in Sources */, 5674A7201F30A8DF0095F066 /* MutablePersistableEncodableTests.swift in Sources */, 56D496551D812F83008276D7 /* FoundationDataTests.swift in Sources */, - 56D4966A1D813086008276D7 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + 56D4966A1D813086008276D7 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, 562206071E420EA4005860AC /* DatabasePoolConcurrencyTests.swift in Sources */, 5698ACB61DA6285E0056AF8C /* FTS3TokenizerTests.swift in Sources */, 56D4965C1D81304E008276D7 /* FoundationNSNullTests.swift in Sources */, @@ -2728,14 +2728,14 @@ 56CEB55A1EAA359A00BFAF62 /* SQLOrdering.swift in Sources */, 56BF6D2F1DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */, 56A238811B9C75030082EB20 /* DatabaseError.swift in Sources */, - 56D51D001EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */, + 56D51D001EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */, 566475BA1D981AD200FF74B8 /* SQLSpecificExpressible+QueryInterface.swift in Sources */, 56A238851B9C75030082EB20 /* DatabaseValue.swift in Sources */, 5671FC201DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */, 56A238A41B9C753B0082EB20 /* Record.swift in Sources */, 56CEB5451EAA359A00BFAF62 /* Column.swift in Sources */, 5657AB0F1D10899D006283EF /* URL.swift in Sources */, - 560D924B1C672C4B00F4F92B /* TableMapping.swift in Sources */, + 560D924B1C672C4B00F4F92B /* TableRecord.swift in Sources */, 56DAA2DB1DE9C827006E10C8 /* Cursor.swift in Sources */, 5674A6EB1F307F0E0095F066 /* DatabaseValueConvertible+Encodable.swift in Sources */, 560A37A41C8F625000949E71 /* DatabasePool.swift in Sources */, diff --git a/GRDB/Legacy/Fixits-0-90-1.swift b/GRDB/Legacy/Fixits-0-90-1.swift index e3f6f7b35..9dcb57781 100644 --- a/GRDB/Legacy/Fixits-0-90-1.swift +++ b/GRDB/Legacy/Fixits-0-90-1.swift @@ -39,7 +39,7 @@ extension DecodableRecord { public static func fetch(_ db: Database, _ sql: String, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) -> Any { preconditionFailure() } } -extension DecodableRecord where Self: TableMapping { +extension DecodableRecord where Self: TableRecord { @available(*, unavailable, renamed:"fetchCursor") public static func fetch(_ db: Database) -> Any { preconditionFailure() } @available(*, unavailable, renamed:"fetchCursor") diff --git a/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift b/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift index aa1229783..7d958533e 100644 --- a/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/FTS3+QueryInterfaceRequest.swift @@ -22,7 +22,7 @@ extension QueryInterfaceRequest { } } -extension TableMapping { +extension TableRecord { // MARK: Full Text Search @@ -35,8 +35,8 @@ extension TableMapping { /// database row. /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func matching(_ pattern: FTS3Pattern?) -> QueryInterfaceRequest { return all().matching(pattern) } diff --git a/GRDB/QueryInterface/FTS5+QueryInterface.swift b/GRDB/QueryInterface/FTS5+QueryInterface.swift index bb0191eae..b7423d5da 100644 --- a/GRDB/QueryInterface/FTS5+QueryInterface.swift +++ b/GRDB/QueryInterface/FTS5+QueryInterface.swift @@ -14,8 +14,8 @@ /// database row. /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public func matching(_ pattern: FTS5Pattern?) -> QueryInterfaceRequest { switch query.source { case .table(let name, let alias)?: @@ -31,7 +31,7 @@ } } - extension TableMapping { + extension TableRecord { // MARK: Full Text Search diff --git a/GRDB/QueryInterface/QueryInterfaceRequest.swift b/GRDB/QueryInterface/QueryInterfaceRequest.swift index 420d10c57..02b7bf0b5 100644 --- a/GRDB/QueryInterface/QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/QueryInterfaceRequest.swift @@ -246,7 +246,7 @@ extension QueryInterfaceRequest { } } -extension QueryInterfaceRequest where T: TableMapping { +extension QueryInterfaceRequest where T: TableRecord { /// Creates a QueryInterfaceRequest with the provided primary key *predicate*. /// @@ -255,8 +255,8 @@ extension QueryInterfaceRequest where T: TableMapping { /// request = request.filter(key: 1) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public func filter(key: PrimaryKeyType?) -> QueryInterfaceRequest { guard let key = key else { return T.none() @@ -272,8 +272,8 @@ extension QueryInterfaceRequest where T: TableMapping { /// request = request.filter(keys: [1, 2, 3]) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public func filter(keys: Sequence) -> QueryInterfaceRequest where Sequence.Element: DatabaseValueConvertible { let keys = Array(keys) let makePredicate: (Column) -> SQLExpression @@ -308,8 +308,8 @@ extension QueryInterfaceRequest where T: TableMapping { /// index on the key columns. /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public func filter(key: [String: DatabaseValueConvertible?]?) -> QueryInterfaceRequest { guard let key = key else { return T.none() @@ -327,8 +327,8 @@ extension QueryInterfaceRequest where T: TableMapping { /// index on the key columns. /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public func filter(keys: [[String: DatabaseValueConvertible?]]) -> QueryInterfaceRequest { guard !keys.isEmpty else { return T.none() @@ -381,7 +381,7 @@ extension QueryInterfaceRequest where RowDecoder: MutablePersistable { } } -extension TableMapping { +extension TableRecord { // MARK: Request Derivation @@ -391,8 +391,8 @@ extension TableMapping { /// let request = Player.all() /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func all() -> QueryInterfaceRequest { let query = QueryInterfaceQuery( select: databaseSelection, @@ -435,8 +435,8 @@ extension TableMapping { /// let request = Player.filter(Column("email") == "arthur@example.com") /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func filter(_ predicate: SQLExpressible) -> QueryInterfaceRequest { return all().filter(predicate) } @@ -447,8 +447,8 @@ extension TableMapping { /// let request = Player.filter(key: 1) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func filter(key: PrimaryKeyType?) -> QueryInterfaceRequest { return all().filter(key: key) } @@ -459,8 +459,8 @@ extension TableMapping { /// let request = Player.filter(keys: [1, 2, 3]) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func filter(keys: Sequence) -> QueryInterfaceRequest where Sequence.Element: DatabaseValueConvertible { return all().filter(keys: keys) } @@ -474,8 +474,8 @@ extension TableMapping { /// index on the key columns. /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func filter(key: [String: DatabaseValueConvertible?]?) -> QueryInterfaceRequest { return all().filter(key: key) } @@ -489,8 +489,8 @@ extension TableMapping { /// index on the key columns. /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func filter(keys: [[String: DatabaseValueConvertible?]]) -> QueryInterfaceRequest { return all().filter(keys: keys) } @@ -501,8 +501,8 @@ extension TableMapping { /// let request = Player.filter(sql: "email = ?", arguments: ["arthur@example.com"]) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func filter(sql: String, arguments: StatementArguments? = nil) -> QueryInterfaceRequest { return all().filter(sql: sql, arguments: arguments) } @@ -514,8 +514,8 @@ extension TableMapping { /// let request = Player.order(Column("name")) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func order(_ orderings: SQLOrderingTerm...) -> QueryInterfaceRequest { return all().order(orderings) } @@ -527,8 +527,8 @@ extension TableMapping { /// let request = Player.order([Column("name")]) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func order(_ orderings: [SQLOrderingTerm]) -> QueryInterfaceRequest { return all().order(orderings) } @@ -539,8 +539,8 @@ extension TableMapping { /// let request = Player.order(sql: "name") /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func order(sql: String, arguments: StatementArguments? = nil) -> QueryInterfaceRequest { return all().order(sql: sql, arguments: arguments) } @@ -552,8 +552,8 @@ extension TableMapping { /// let request = Player.limit(1) /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. public static func limit(_ limit: Int, offset: Int? = nil) -> QueryInterfaceRequest { return all().limit(limit, offset: offset) } diff --git a/GRDB/QueryInterface/SQLSelectable+QueryInterface.swift b/GRDB/QueryInterface/SQLSelectable+QueryInterface.swift index 78d2da736..8791b3edc 100644 --- a/GRDB/QueryInterface/SQLSelectable+QueryInterface.swift +++ b/GRDB/QueryInterface/SQLSelectable+QueryInterface.swift @@ -3,11 +3,11 @@ /// AllColumns is the `*` in `SELECT *`. /// /// You use AllColumns in your custom implementation of -/// TableMapping.databaseSelection. +/// TableRecord.databaseSelection. /// /// For example: /// -/// struct Player : TableMapping { +/// struct Player : TableRecord { /// static var databaseTableName = "players" /// static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID] /// } diff --git a/GRDB/Record/DecodableRecord+TableMapping.swift b/GRDB/Record/DecodableRecord+TableRecord.swift similarity index 91% rename from GRDB/Record/DecodableRecord+TableMapping.swift rename to GRDB/Record/DecodableRecord+TableRecord.swift index 38872aeb7..f5a529ab9 100644 --- a/GRDB/Record/DecodableRecord+TableMapping.swift +++ b/GRDB/Record/DecodableRecord+TableRecord.swift @@ -1,4 +1,4 @@ -extension DecodableRecord where Self: TableMapping { +extension DecodableRecord where Self: TableRecord { // MARK: Fetching All @@ -18,8 +18,8 @@ extension DecodableRecord where Self: TableMapping { /// The cursor must be iterated in a protected dispath queue. /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. /// /// - parameter db: A database connection. /// - returns: A cursor over fetched records. @@ -34,8 +34,8 @@ extension DecodableRecord where Self: TableMapping { /// let players = try Player.fetchAll(db) // [Player] /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. /// /// - parameter db: A database connection. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. @@ -49,8 +49,8 @@ extension DecodableRecord where Self: TableMapping { /// let player = try Player.fetchOne(db) // Player? /// /// The selection defaults to all columns. This default can be changed for - /// all requests by the `TableMapping.databaseSelection` property, or - /// for individual requests with the `TableMapping.select` method. + /// all requests by the `TableRecord.databaseSelection` property, or + /// for individual requests with the `TableRecord.select` method. /// /// - parameter db: A database connection. /// - throws: A DatabaseError is thrown whenever an SQLite error occurs. @@ -59,7 +59,7 @@ extension DecodableRecord where Self: TableMapping { } } -extension DecodableRecord where Self: TableMapping { +extension DecodableRecord where Self: TableRecord { // MARK: Fetching by Single-Column Primary Key @@ -119,7 +119,7 @@ extension DecodableRecord where Self: TableMapping { } } -extension DecodableRecord where Self: TableMapping { +extension DecodableRecord where Self: TableRecord { // MARK: Fetching by Key diff --git a/GRDB/Record/FetchedRecordsController.swift b/GRDB/Record/FetchedRecordsController.swift index 280db9460..e1cd2af1a 100644 --- a/GRDB/Record/FetchedRecordsController.swift +++ b/GRDB/Record/FetchedRecordsController.swift @@ -393,7 +393,7 @@ public final class FetchedRecordsController { fileprivate var errorHandler: ((FetchedRecordsController, Error) -> ())? } -extension FetchedRecordsController where Record: TableMapping { +extension FetchedRecordsController where Record: TableRecord { // MARK: - Initialization diff --git a/GRDB/Record/Persistable.swift b/GRDB/Record/Persistable.swift index 824617966..a6c241e39 100644 --- a/GRDB/Record/Persistable.swift +++ b/GRDB/Record/Persistable.swift @@ -169,7 +169,7 @@ public struct PersistenceConflictPolicy { } /// Types that adopt MutablePersistable can be inserted, updated, and deleted. -public protocol MutablePersistable : TableMapping { +public protocol MutablePersistable : TableRecord { /// The policy that handles SQLite conflicts when records are inserted /// or updated. /// diff --git a/GRDB/Record/Record.swift b/GRDB/Record/Record.swift index cbaf30d13..f07b4eb5a 100644 --- a/GRDB/Record/Record.swift +++ b/GRDB/Record/Record.swift @@ -2,7 +2,7 @@ /// Record is a class that wraps a table row, or the result of any query. It is /// designed to be subclassed. -open class Record : DecodableRecord, TableMapping, Persistable { +open class Record : DecodableRecord, TableRecord, Persistable { // MARK: - Initializers diff --git a/GRDB/Record/RecordBox.swift b/GRDB/Record/RecordBox.swift index 8a368fcbe..f898e6241 100644 --- a/GRDB/Record/RecordBox.swift +++ b/GRDB/Record/RecordBox.swift @@ -40,7 +40,7 @@ public final class RecordBox: Record { super.init(row: row) } - // MARK: - TableMapping + // MARK: - TableRecord /// :nodoc: override public class var databaseTableName: String { diff --git a/GRDB/Record/TableMapping.swift b/GRDB/Record/TableRecord.swift similarity index 87% rename from GRDB/Record/TableMapping.swift rename to GRDB/Record/TableRecord.swift index 1029fd30a..4ea8692bf 100644 --- a/GRDB/Record/TableMapping.swift +++ b/GRDB/Record/TableRecord.swift @@ -1,17 +1,17 @@ -/// Types that adopt TableMapping declare a particular relationship with +/// Types that adopt TableRecord declare a particular relationship with /// a database table. /// -/// Types that adopt both TableMapping and DecodableRecord are granted with +/// Types that adopt both TableRecord and DecodableRecord are granted with /// built-in methods that allow to fetch instances identified by key: /// /// try Player.fetchOne(db, key: 123) // Player? /// try Citizenship.fetchOne(db, key: ["citizenId": 12, "countryId": 45]) // Citizenship? /// -/// TableMapping is adopted by Record. -public protocol TableMapping { +/// TableRecord is adopted by Record. +public protocol TableRecord { /// The name of the database table used to build requests. /// - /// struct Player : TableMapping { + /// struct Player : TableRecord { /// static var databaseTableName = "players" /// } /// @@ -29,7 +29,7 @@ public protocol TableMapping { /// You can provide a custom implementation and provide an explicit list /// of columns: /// - /// struct RestrictedPlayer : TableMapping { + /// struct RestrictedPlayer : TableRecord { /// static var databaseTableName = "players" /// static var databaseSelection = [Column("id"), Column("name")] /// } @@ -39,7 +39,7 @@ public protocol TableMapping { /// /// You can also add extra columns such as the `rowid` column: /// - /// struct ExtendedPlayer : TableMapping { + /// struct ExtendedPlayer : TableRecord { /// static var databaseTableName = "players" /// static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID] /// } @@ -49,14 +49,14 @@ public protocol TableMapping { static var databaseSelection: [SQLSelectable] { get } } -extension TableMapping { +extension TableRecord { /// Default value: `[AllColumns()]`. public static var databaseSelection: [SQLSelectable] { return [AllColumns()] } } -extension TableMapping { +extension TableRecord { // MARK: - Counting All @@ -68,7 +68,7 @@ extension TableMapping { } } -extension TableMapping { +extension TableRecord { // MARK: - SQL Generation @@ -76,7 +76,7 @@ extension TableMapping { /// /// For example: /// - /// struct Player: TableMapping { + /// struct Player: TableRecord { /// static let databaseTableName = "players" /// } /// @@ -98,7 +98,7 @@ extension TableMapping { /// /// For example: /// - /// struct Player: TableMapping { + /// struct Player: TableRecord { /// static let databaseTableName = "players" /// } /// diff --git a/GRDBCipher.xcodeproj/project.pbxproj b/GRDBCipher.xcodeproj/project.pbxproj index 52531e732..0ebaec7b5 100755 --- a/GRDBCipher.xcodeproj/project.pbxproj +++ b/GRDBCipher.xcodeproj/project.pbxproj @@ -22,7 +22,7 @@ 560FC52A1CB003810014AA8E /* DatabaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238731B9C75030082EB20 /* DatabaseError.swift */; }; 560FC52B1CB003810014AA8E /* DatabaseValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238751B9C75030082EB20 /* DatabaseValue.swift */; }; 560FC52E1CB003810014AA8E /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238A11B9C753B0082EB20 /* Record.swift */; }; - 560FC5311CB003810014AA8E /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; + 560FC5311CB003810014AA8E /* TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableRecord.swift */; }; 560FC5321CB003810014AA8E /* DatabasePool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560A37A31C8F625000949E71 /* DatabasePool.swift */; }; 560FC5331CB003810014AA8E /* Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4391BEB42D500E39BBF /* Migration.swift */; }; 560FC5341CB003810014AA8E /* QueryInterfaceQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5605F18C1C6B1A8700235C62 /* QueryInterfaceQuery.swift */; }; @@ -79,7 +79,7 @@ 560FC5991CB00B880014AA8E /* RecordMinimalPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238271B9C74A90082EB20 /* RecordMinimalPrimaryKeySingleTests.swift */; }; 560FC59B1CB00B880014AA8E /* DatabaseTimestampTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238B51B9CA2590082EB20 /* DatabaseTimestampTests.swift */; }; 560FC59C1CB00B880014AA8E /* StatementArguments+FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565D5D731BBC70AE00DC9BD4 /* StatementArguments+FoundationTests.swift */; }; - 560FC59D1CB00B880014AA8E /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + 560FC59D1CB00B880014AA8E /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; 560FC59E1CB00B880014AA8E /* FoundationNSDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */; }; 560FC59F1CB00B880014AA8E /* DatabaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238131B9C74A90082EB20 /* DatabaseTests.swift */; }; 560FC5A01CB00B880014AA8E /* QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */; }; @@ -326,7 +326,7 @@ 567156571CB16729007DC145 /* RecordMinimalPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238271B9C74A90082EB20 /* RecordMinimalPrimaryKeySingleTests.swift */; }; 567156591CB16729007DC145 /* DatabaseTimestampTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238B51B9CA2590082EB20 /* DatabaseTimestampTests.swift */; }; 5671565A1CB16729007DC145 /* StatementArguments+FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565D5D731BBC70AE00DC9BD4 /* StatementArguments+FoundationTests.swift */; }; - 5671565B1CB16729007DC145 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + 5671565B1CB16729007DC145 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; 5671565C1CB16729007DC145 /* FoundationNSDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */; }; 5671565D1CB16729007DC145 /* DatabaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238131B9C74A90082EB20 /* DatabaseTests.swift */; }; 5671565E1CB16729007DC145 /* QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */; }; @@ -523,7 +523,7 @@ 56AFC9FD1CB1A8BB00F48B96 /* NSString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5605F1521C672E4000235C62 /* NSString.swift */; }; 56AFC9FF1CB1A8BB00F48B96 /* DatabaseValueConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D923E1C672C3E00F4F92B /* DatabaseValueConvertible.swift */; }; 56AFCA001CB1A8BB00F48B96 /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238A11B9C753B0082EB20 /* Record.swift */; }; - 56AFCA031CB1A8BB00F48B96 /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; + 56AFCA031CB1A8BB00F48B96 /* TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableRecord.swift */; }; 56AFCA061CB1A8BB00F48B96 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238701B9C75030082EB20 /* Configuration.swift */; }; 56AFCA071CB1A8BB00F48B96 /* DatabasePool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560A37A31C8F625000949E71 /* DatabasePool.swift */; }; 56AFCA081CB1A8BB00F48B96 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238781B9C75030082EB20 /* Statement.swift */; }; @@ -595,7 +595,7 @@ 56AFCA681CB1AA9900F48B96 /* RecordMinimalPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238271B9C74A90082EB20 /* RecordMinimalPrimaryKeySingleTests.swift */; }; 56AFCA6B1CB1AA9900F48B96 /* DatabaseTimestampTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238B51B9CA2590082EB20 /* DatabaseTimestampTests.swift */; }; 56AFCA6C1CB1AA9900F48B96 /* StatementArguments+FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565D5D731BBC70AE00DC9BD4 /* StatementArguments+FoundationTests.swift */; }; - 56AFCA6D1CB1AA9900F48B96 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + 56AFCA6D1CB1AA9900F48B96 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; 56AFCA6E1CB1AA9900F48B96 /* FoundationNSDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */; }; 56AFCA6F1CB1AA9900F48B96 /* DatabaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238131B9C74A90082EB20 /* DatabaseTests.swift */; }; 56AFCA701CB1AA9900F48B96 /* QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */; }; @@ -655,7 +655,7 @@ 56AFCAC11CB1ABC800F48B96 /* RecordMinimalPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238271B9C74A90082EB20 /* RecordMinimalPrimaryKeySingleTests.swift */; }; 56AFCAC41CB1ABC800F48B96 /* DatabaseTimestampTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238B51B9CA2590082EB20 /* DatabaseTimestampTests.swift */; }; 56AFCAC51CB1ABC800F48B96 /* StatementArguments+FoundationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565D5D731BBC70AE00DC9BD4 /* StatementArguments+FoundationTests.swift */; }; - 56AFCAC61CB1ABC800F48B96 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + 56AFCAC61CB1ABC800F48B96 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; 56AFCAC71CB1ABC800F48B96 /* FoundationNSDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */; }; 56AFCAC81CB1ABC800F48B96 /* DatabaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238131B9C74A90082EB20 /* DatabaseTests.swift */; }; 56AFCAC91CB1ABC800F48B96 /* QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */; }; @@ -736,8 +736,8 @@ 56D507601F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */; }; 56D507631F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */; }; 56D507641F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */; }; - 56D51D011EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */; }; - 56D51D041EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */; }; + 56D51D011EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */; }; + 56D51D041EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */; }; 56DAA2D31DE99DAB006E10C8 /* DatabaseCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */; }; 56DAA2D41DE99DAB006E10C8 /* DatabaseCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */; }; 56DAA2D71DE99DAB006E10C8 /* DatabaseCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */; }; @@ -755,10 +755,10 @@ 56F3E7671E67F8C100BF0F01 /* Fixits-0.101.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */; }; 56FC98791D969DEF00E3C842 /* SQLExpression+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */; }; 56FC987C1D969DEF00E3C842 /* SQLExpression+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */; }; - 56FEE7FC1F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; - 56FEE7FD1F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; - 56FEE8001F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; - 56FEE8011F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; + 56FEE7FC1F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; + 56FEE7FD1F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; + 56FEE8001F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; + 56FEE8011F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; 56FF45411D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */; }; 56FF45421D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */; }; 56FF45451D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */; }; @@ -846,7 +846,7 @@ 560D923E1C672C3E00F4F92B /* DatabaseValueConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConvertible.swift; sourceTree = ""; }; 560D923F1C672C3E00F4F92B /* StatementColumnConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementColumnConvertible.swift; sourceTree = ""; }; 560D92441C672C4B00F4F92B /* Persistable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistable.swift; sourceTree = ""; }; - 560D92461C672C4B00F4F92B /* TableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableMapping.swift; sourceTree = ""; }; + 560D92461C672C4B00F4F92B /* TableRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRecord.swift; sourceTree = ""; }; 560FC54D1CB003810014AA8E /* GRDBCipher.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GRDBCipher.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 560FC5501CB004AD0014AA8E /* sqlcipher.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = sqlcipher.xcodeproj; path = SQLCipher/src/sqlcipher.xcodeproj; sourceTree = ""; }; 560FC5B01CB00B880014AA8E /* GRDBCipherOSXTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBCipherOSXTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -865,7 +865,7 @@ 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceRequestTests.swift; sourceTree = ""; }; 56300B601C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceExpressionsTests.swift; sourceTree = ""; }; - 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TableMapping+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; + 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TableRecord+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 56300B6F1C53F592005A543B /* QueryInterfaceRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceRequest.swift; sourceTree = ""; }; 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Record+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 563363A91C933FF8000BE133 /* MutablePersistableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableTests.swift; sourceTree = ""; }; @@ -1056,7 +1056,7 @@ 56CEB5441EAA359A00BFAF62 /* SQLSelectable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLSelectable.swift; sourceTree = ""; }; 56D121591ED34978001347D2 /* Fixits-0.109.0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.109.0.swift"; sourceTree = ""; }; 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryKeyInfoTests.swift; sourceTree = ""; }; - 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+TableMapping.swift"; sourceTree = ""; }; + 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+TableRecord.swift"; sourceTree = ""; }; 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCursorTests.swift; sourceTree = ""; }; 56DAA2DA1DE9C827006E10C8 /* Cursor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cursor.swift; sourceTree = ""; }; 56DE7B101C3D93ED00861EB8 /* StatementArgumentsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementArgumentsTests.swift; sourceTree = ""; }; @@ -1073,7 +1073,7 @@ 56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.101.1.swift"; sourceTree = ""; }; 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SQLExpression+QueryInterface.swift"; sourceTree = ""; }; 56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromStatementTests.swift; sourceTree = ""; }; - 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableMappingTests.swift; sourceTree = ""; }; + 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableRecordTests.swift; sourceTree = ""; }; 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableDeleteTests.swift; sourceTree = ""; }; 56FF45551D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordUniqueIndexTests.swift; sourceTree = ""; }; 6340BF7F1E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordPersistenceConflictPolicy.swift; sourceTree = ""; }; @@ -1255,12 +1255,12 @@ path = GRDBTests; sourceTree = ""; }; - 56176C9C1EACEA8C000F3F2B /* TableMapping */ = { + 56176C9C1EACEA8C000F3F2B /* TableRecord */ = { isa = PBXGroup; children = ( - 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */, + 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */, ); - name = TableMapping; + name = TableRecord; sourceTree = ""; }; 56176C9E1EACEDF9000F3F2B /* Record */ = { @@ -1319,7 +1319,7 @@ 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */, 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */, 566AD8C51D531BE4002EC1A8 /* TableDefinitionTests.swift */, - 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */, + 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */, 5698AC7F1DA380A20056AF8C /* VirtualTableModuleTests.swift */, ); name = QueryInterface; @@ -1534,7 +1534,7 @@ 560B3FA41C19DFF800C58EC7 /* Persistable */, 56176C9E1EACEDF9000F3F2B /* Record */, 5680521C2013296800E87861 /* RecordBoxTests.swift */, - 56176C9C1EACEA8C000F3F2B /* TableMapping */, + 56176C9C1EACEA8C000F3F2B /* TableRecord */, ); name = Record; sourceTree = ""; @@ -1587,13 +1587,13 @@ children = ( 56CEB4F01EAA2EFA00BFAF62 /* DecodableRecord.swift */, 5674A6F21F307F600095F066 /* DecodableRecord+Decodable.swift */, - 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */, + 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */, 31A7787C1C6A4DD600F507F6 /* FetchedRecordsController.swift */, 560D92441C672C4B00F4F92B /* Persistable.swift */, 5674A6F31F307F600095F066 /* Persistable+Encodable.swift */, 56A238A11B9C753B0082EB20 /* Record.swift */, 5680520A2013209300E87861 /* RecordBox.swift */, - 560D92461C672C4B00F4F92B /* TableMapping.swift */, + 560D92461C672C4B00F4F92B /* TableRecord.swift */, ); path = Record; sourceTree = ""; @@ -2033,14 +2033,14 @@ 56CEB55B1EAA359A00BFAF62 /* SQLOrdering.swift in Sources */, 56BF6D301DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */, 560FC52A1CB003810014AA8E /* DatabaseError.swift in Sources */, - 56D51D011EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */, + 56D51D011EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */, 566475BB1D981AD200FF74B8 /* SQLSpecificExpressible+QueryInterface.swift in Sources */, 560FC52B1CB003810014AA8E /* DatabaseValue.swift in Sources */, 5671FC211DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */, 560FC52E1CB003810014AA8E /* Record.swift in Sources */, 56CEB5461EAA359A00BFAF62 /* Column.swift in Sources */, 5657AB101D10899D006283EF /* URL.swift in Sources */, - 560FC5311CB003810014AA8E /* TableMapping.swift in Sources */, + 560FC5311CB003810014AA8E /* TableRecord.swift in Sources */, 56DAA2DC1DE9C827006E10C8 /* Cursor.swift in Sources */, 5674A6F11F307F0E0095F066 /* DatabaseValueConvertible+Encodable.swift in Sources */, 560FC5321CB003810014AA8E /* DatabasePool.swift in Sources */, @@ -2165,7 +2165,7 @@ 560FC5891CB00B880014AA8E /* TransactionObserverTests.swift in Sources */, 5674A72C1F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, 56C3F7541CF9F12400F6A361 /* DatabaseSavepointTests.swift in Sources */, - 56FEE7FC1F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE7FC1F47253700D930EA /* TableRecordTests.swift in Sources */, 56F3E74A1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */, 567A80541D41350C00C7DCEC /* IndexInfoTests.swift in Sources */, 560FC58B1CB00B880014AA8E /* DatabaseValueTests.swift in Sources */, @@ -2198,7 +2198,7 @@ 5623936A1DEE0CD200A6B01F /* FlattenCursorTests.swift in Sources */, 560FC59C1CB00B880014AA8E /* StatementArguments+FoundationTests.swift in Sources */, 5657AB671D108BA9006283EF /* FoundationURLTests.swift in Sources */, - 560FC59D1CB00B880014AA8E /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + 560FC59D1CB00B880014AA8E /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, 562205F51E420E48005860AC /* DatabasePoolSchemaCacheTests.swift in Sources */, 566A84462041AB3900E50BFD /* MutablePersistableChangesTests.swift in Sources */, 562393581DEE013C00A6B01F /* FilterCursorTests.swift in Sources */, @@ -2312,7 +2312,7 @@ 567156481CB16729007DC145 /* DatabaseValueTests.swift in Sources */, 5674A72E1F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, 5671564A1CB16729007DC145 /* DatabaseQueueReadOnlyTests.swift in Sources */, - 56FEE7FD1F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE7FD1F47253700D930EA /* TableRecordTests.swift in Sources */, 56F3E74B1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */, 5671564B1CB16729007DC145 /* Row+FoundationTests.swift in Sources */, 56A8C2431D1918EE0096E9D4 /* FoundationNSUUIDTests.swift in Sources */, @@ -2349,7 +2349,7 @@ 562205F81E420E49005860AC /* DatabasePoolSchemaCacheTests.swift in Sources */, 566A84472041AB3900E50BFD /* MutablePersistableChangesTests.swift in Sources */, 562393591DEE013C00A6B01F /* FilterCursorTests.swift in Sources */, - 5671565B1CB16729007DC145 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + 5671565B1CB16729007DC145 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, 568068331EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */, 5671565C1CB16729007DC145 /* FoundationNSDateTests.swift in Sources */, 5671565D1CB16729007DC145 /* DatabaseTests.swift in Sources */, @@ -2427,11 +2427,11 @@ 56CEB55E1EAA359A00BFAF62 /* SQLOrdering.swift in Sources */, 56BF6D331DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */, 56AFC9FF1CB1A8BB00F48B96 /* DatabaseValueConvertible.swift in Sources */, - 56D51D041EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */, + 56D51D041EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */, 566475BE1D981AD200FF74B8 /* SQLSpecificExpressible+QueryInterface.swift in Sources */, 56AFCA001CB1A8BB00F48B96 /* Record.swift in Sources */, 5671FC241DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */, - 56AFCA031CB1A8BB00F48B96 /* TableMapping.swift in Sources */, + 56AFCA031CB1A8BB00F48B96 /* TableRecord.swift in Sources */, 56CEB5491EAA359A00BFAF62 /* Column.swift in Sources */, 5657AB131D10899D006283EF /* URL.swift in Sources */, 56AFCA061CB1A8BB00F48B96 /* Configuration.swift in Sources */, @@ -2560,7 +2560,7 @@ 5698AC451DA2BED90056AF8C /* FTS3PatternTests.swift in Sources */, 5674A72B1F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, 56AF74701D41FB9C005E9FF3 /* DatabaseValueConvertibleEscapingTests.swift in Sources */, - 56FEE8001F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE8001F47253700D930EA /* TableRecordTests.swift in Sources */, 56F3E74E1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */, 5690C33C1D23E7D200E59934 /* FoundationDateTests.swift in Sources */, 56AFCA581CB1AA9900F48B96 /* Row+FoundationTests.swift in Sources */, @@ -2601,7 +2601,7 @@ 56AFCA6C1CB1AA9900F48B96 /* StatementArguments+FoundationTests.swift in Sources */, 562393651DEE06D300A6B01F /* CursorTests.swift in Sources */, 5657AB5B1D108BA9006283EF /* FoundationNSStringTests.swift in Sources */, - 56AFCA6D1CB1AA9900F48B96 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + 56AFCA6D1CB1AA9900F48B96 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, 56AFCA6E1CB1AA9900F48B96 /* FoundationNSDateTests.swift in Sources */, 5674A7211F30A8DF0095F066 /* MutablePersistableEncodableTests.swift in Sources */, 56AFCA6F1CB1AA9900F48B96 /* DatabaseTests.swift in Sources */, @@ -2707,7 +2707,7 @@ 56AF74711D41FB9C005E9FF3 /* DatabaseValueConvertibleEscapingTests.swift in Sources */, 5674A7281F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, 56AFCAAE1CB1ABC800F48B96 /* RawRepresentable+DatabaseValueConvertibleTests.swift in Sources */, - 56FEE8011F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE8011F47253700D930EA /* TableRecordTests.swift in Sources */, 56F3E74F1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */, 56AFCAAF1CB1ABC800F48B96 /* DatabasePoolConcurrencyTests.swift in Sources */, 56AFCAB01CB1ABC800F48B96 /* TransactionObserverTests.swift in Sources */, @@ -2747,7 +2747,7 @@ 568068371EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */, 56AFCAC51CB1ABC800F48B96 /* StatementArguments+FoundationTests.swift in Sources */, 562393661DEE06D300A6B01F /* CursorTests.swift in Sources */, - 56AFCAC61CB1ABC800F48B96 /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + 56AFCAC61CB1ABC800F48B96 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, 56AFCAC71CB1ABC800F48B96 /* FoundationNSDateTests.swift in Sources */, 56AFCAC81CB1ABC800F48B96 /* DatabaseTests.swift in Sources */, 5674A71E1F30A8DF0095F066 /* MutablePersistableEncodableTests.swift in Sources */, diff --git a/GRDBCustom.xcodeproj/project.pbxproj b/GRDBCustom.xcodeproj/project.pbxproj index bd0f1dcba..63d371093 100755 --- a/GRDBCustom.xcodeproj/project.pbxproj +++ b/GRDBCustom.xcodeproj/project.pbxproj @@ -262,8 +262,8 @@ 56D1215F1ED34978001347D2 /* Fixits-0.109.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D121591ED34978001347D2 /* Fixits-0.109.0.swift */; }; 56D507611F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */; }; 56D507651F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */; }; - 56D51D021EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */; }; - 56D51D051EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */; }; + 56D51D021EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */; }; + 56D51D051EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */; }; 56DAA2D51DE99DAB006E10C8 /* DatabaseCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */; }; 56DAA2D91DE99DAB006E10C8 /* DatabaseCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */; }; 56DAA2DD1DE9C827006E10C8 /* Cursor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DAA2DA1DE9C827006E10C8 /* Cursor.swift */; }; @@ -278,8 +278,8 @@ 56F3E7681E67F8C100BF0F01 /* Fixits-0.101.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */; }; 56FC987A1D969DEF00E3C842 /* SQLExpression+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */; }; 56FC987D1D969DEF00E3C842 /* SQLExpression+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */; }; - 56FEE7FE1F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; - 56FEE8021F47253700D930EA /* TableMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */; }; + 56FEE7FE1F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; + 56FEE8021F47253700D930EA /* TableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */; }; 56FF45431D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */; }; 56FF45471D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */; }; 56FF45591D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FF45551D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift */; }; @@ -319,7 +319,7 @@ F3BA80321CFB28A4003DC1BA /* FetchedRecordsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A7787C1C6A4DD600F507F6 /* FetchedRecordsController.swift */; }; F3BA80331CFB28A4003DC1BA /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92441C672C4B00F4F92B /* Persistable.swift */; }; F3BA80341CFB28A4003DC1BA /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238A11B9C753B0082EB20 /* Record.swift */; }; - F3BA80361CFB28A4003DC1BA /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; + F3BA80361CFB28A4003DC1BA /* TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableRecord.swift */; }; F3BA80381CFB2932003DC1BA /* GRDBCustomSQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BA7FF11CFB23D3003DC1BA /* GRDBCustomSQLite.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3BA80391CFB2936003DC1BA /* GRDBCustomSQLite-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BA7FF21CFB23DA003DC1BA /* GRDBCustomSQLite-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3BA803A1CFB293A003DC1BA /* sqlite3.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BA7FF01CFB23C9003DC1BA /* sqlite3.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -363,7 +363,7 @@ F3BA808E1CFB2E7A003DC1BA /* FetchedRecordsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A7787C1C6A4DD600F507F6 /* FetchedRecordsController.swift */; }; F3BA808F1CFB2E7A003DC1BA /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92441C672C4B00F4F92B /* Persistable.swift */; }; F3BA80901CFB2E7A003DC1BA /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238A11B9C753B0082EB20 /* Record.swift */; }; - F3BA80921CFB2E7A003DC1BA /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; + F3BA80921CFB2E7A003DC1BA /* TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableRecord.swift */; }; F3BA80931CFB2F13003DC1BA /* GRDBCustomSQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BA7FF11CFB23D3003DC1BA /* GRDBCustomSQLite.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3BA80941CFB2F15003DC1BA /* GRDBCustomSQLite-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BA7FF21CFB23DA003DC1BA /* GRDBCustomSQLite-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3BA80951CFB2F18003DC1BA /* sqlite3.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BA7FF01CFB23C9003DC1BA /* sqlite3.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -459,12 +459,12 @@ F3BA81151CFB305E003DC1BA /* Record+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */; }; F3BA81161CFB305E003DC1BA /* DecodableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B601C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift */; }; F3BA81171CFB305E003DC1BA /* QueryInterfaceExpressionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */; }; - F3BA81181CFB305E003DC1BA /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + F3BA81181CFB305E003DC1BA /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; F3BA81191CFB305F003DC1BA /* QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */; }; F3BA811A1CFB305F003DC1BA /* Record+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */; }; F3BA811B1CFB305F003DC1BA /* DecodableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B601C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift */; }; F3BA811C1CFB305F003DC1BA /* QueryInterfaceExpressionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */; }; - F3BA811D1CFB305F003DC1BA /* TableMapping+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */; }; + F3BA811D1CFB305F003DC1BA /* TableRecord+QueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */; }; F3BA811E1CFB3063003DC1BA /* RecordMinimalPrimaryKeyRowIDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238261B9C74A90082EB20 /* RecordMinimalPrimaryKeyRowIDTests.swift */; }; F3BA811F1CFB3063003DC1BA /* RecordMinimalPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238271B9C74A90082EB20 /* RecordMinimalPrimaryKeySingleTests.swift */; }; F3BA81201CFB3063003DC1BA /* RecordPrimaryKeyMultipleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238281B9C74A90082EB20 /* RecordPrimaryKeyMultipleTests.swift */; }; @@ -550,7 +550,7 @@ 560D923E1C672C3E00F4F92B /* DatabaseValueConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConvertible.swift; sourceTree = ""; }; 560D923F1C672C3E00F4F92B /* StatementColumnConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementColumnConvertible.swift; sourceTree = ""; }; 560D92441C672C4B00F4F92B /* Persistable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistable.swift; sourceTree = ""; }; - 560D92461C672C4B00F4F92B /* TableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableMapping.swift; sourceTree = ""; }; + 560D92461C672C4B00F4F92B /* TableRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRecord.swift; sourceTree = ""; }; 561667001D08A49900ADD404 /* FoundationNSDecimalNumberTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationNSDecimalNumberTests.swift; sourceTree = ""; }; 562393171DECC02000A6B01F /* RowFetchTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFetchTests.swift; sourceTree = ""; }; 5623932F1DEDFC5700A6B01F /* AnyCursorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyCursorTests.swift; sourceTree = ""; }; @@ -566,7 +566,7 @@ 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceRequestTests.swift; sourceTree = ""; }; 56300B601C53C42C005A543B /* DecodableRecord+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 56300B671C53D25E005A543B /* QueryInterfaceExpressionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceExpressionsTests.swift; sourceTree = ""; }; - 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TableMapping+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; + 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TableRecord+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 56300B6F1C53F592005A543B /* QueryInterfaceRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryInterfaceRequest.swift; sourceTree = ""; }; 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Record+QueryInterfaceRequestTests.swift"; sourceTree = ""; }; 563363A91C933FF8000BE133 /* MutablePersistableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableTests.swift; sourceTree = ""; }; @@ -748,7 +748,7 @@ 56CEB5441EAA359A00BFAF62 /* SQLSelectable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLSelectable.swift; sourceTree = ""; }; 56D121591ED34978001347D2 /* Fixits-0.109.0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.109.0.swift"; sourceTree = ""; }; 56D5075D1F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryKeyInfoTests.swift; sourceTree = ""; }; - 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+TableMapping.swift"; sourceTree = ""; }; + 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DecodableRecord+TableRecord.swift"; sourceTree = ""; }; 56DAA2D11DE99DAB006E10C8 /* DatabaseCursorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCursorTests.swift; sourceTree = ""; }; 56DAA2DA1DE9C827006E10C8 /* Cursor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cursor.swift; sourceTree = ""; }; 56DE7B101C3D93ED00861EB8 /* StatementArgumentsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementArgumentsTests.swift; sourceTree = ""; }; @@ -765,7 +765,7 @@ 56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.101.1.swift"; sourceTree = ""; }; 56FC98771D969DEF00E3C842 /* SQLExpression+QueryInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SQLExpression+QueryInterface.swift"; sourceTree = ""; }; 56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromStatementTests.swift; sourceTree = ""; }; - 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableMappingTests.swift; sourceTree = ""; }; + 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableRecordTests.swift; sourceTree = ""; }; 56FF453F1D2C23BA00F21EF9 /* MutablePersistableDeleteTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableDeleteTests.swift; sourceTree = ""; }; 56FF45551D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordUniqueIndexTests.swift; sourceTree = ""; }; 6340BF7F1E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordPersistenceConflictPolicy.swift; sourceTree = ""; }; @@ -929,12 +929,12 @@ path = GRDBTests; sourceTree = ""; }; - 56176C9C1EACEA8C000F3F2B /* TableMapping */ = { + 56176C9C1EACEA8C000F3F2B /* TableRecord */ = { isa = PBXGroup; children = ( - 56FEE7FA1F47253700D930EA /* TableMappingTests.swift */, + 56FEE7FA1F47253700D930EA /* TableRecordTests.swift */, ); - name = TableMapping; + name = TableRecord; sourceTree = ""; }; 56176C9E1EACEDF9000F3F2B /* Record */ = { @@ -993,7 +993,7 @@ 56300B5D1C53C38F005A543B /* QueryInterfaceRequestTests.swift */, 56300B841C54DC95005A543B /* Record+QueryInterfaceRequestTests.swift */, 566AD8C51D531BE4002EC1A8 /* TableDefinitionTests.swift */, - 56300B6A1C53D3E8005A543B /* TableMapping+QueryInterfaceRequestTests.swift */, + 56300B6A1C53D3E8005A543B /* TableRecord+QueryInterfaceRequestTests.swift */, 5698AC7F1DA380A20056AF8C /* VirtualTableModuleTests.swift */, ); name = QueryInterface; @@ -1208,7 +1208,7 @@ 560B3FA41C19DFF800C58EC7 /* Persistable */, 56176C9E1EACEDF9000F3F2B /* Record */, 568052182013295100E87861 /* RecordBoxTests.swift */, - 56176C9C1EACEA8C000F3F2B /* TableMapping */, + 56176C9C1EACEA8C000F3F2B /* TableRecord */, ); name = Record; sourceTree = ""; @@ -1261,13 +1261,13 @@ children = ( 56CEB4F01EAA2EFA00BFAF62 /* DecodableRecord.swift */, 5674A6F21F307F600095F066 /* DecodableRecord+Decodable.swift */, - 56D51CFF1EA789FA0074638A /* DecodableRecord+TableMapping.swift */, + 56D51CFF1EA789FA0074638A /* DecodableRecord+TableRecord.swift */, 31A7787C1C6A4DD600F507F6 /* FetchedRecordsController.swift */, 560D92441C672C4B00F4F92B /* Persistable.swift */, 5674A6F31F307F600095F066 /* Persistable+Encodable.swift */, 56A238A11B9C753B0082EB20 /* Record.swift */, 568052072013206F00E87861 /* RecordBox.swift */, - 560D92461C672C4B00F4F92B /* TableMapping.swift */, + 560D92461C672C4B00F4F92B /* TableRecord.swift */, ); path = Record; sourceTree = ""; @@ -1737,7 +1737,7 @@ F3BA80201CFB288C003DC1BA /* Date.swift in Sources */, 56A8C2351D1914540096E9D4 /* UUID.swift in Sources */, 56BF6D341DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */, - 56D51D051EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */, + 56D51D051EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */, F3BA80151CFB2876003DC1BA /* DatabaseWriter.swift in Sources */, F3BA800A1CFB286A003DC1BA /* Configuration.swift in Sources */, 566475BF1D981AD200FF74B8 /* SQLSpecificExpressible+QueryInterface.swift in Sources */, @@ -1771,7 +1771,7 @@ F3BA802C1CFB289B003DC1BA /* SQLCollatedExpression.swift in Sources */, 569A98F92039B716008D7DBF /* Fixits-3.0.swift in Sources */, F3BA80301CFB289F003DC1BA /* DatabaseMigrator.swift in Sources */, - F3BA80361CFB28A4003DC1BA /* TableMapping.swift in Sources */, + F3BA80361CFB28A4003DC1BA /* TableRecord.swift in Sources */, F3BA80271CFB2891003DC1BA /* DatabaseValueConvertible+RawRepresentable.swift in Sources */, 5680520E201320A200E87861 /* RecordBox.swift in Sources */, 566475A71D9810A400FF74B8 /* SQLSelectable+QueryInterface.swift in Sources */, @@ -1804,7 +1804,7 @@ F3BA80C61CFB2FD8003DC1BA /* DatabaseQueueConcurrencyTests.swift in Sources */, F3BA81161CFB305E003DC1BA /* DecodableRecord+QueryInterfaceRequestTests.swift in Sources */, F3BA80F41CFB301D003DC1BA /* StatementColumnConvertibleFetchTests.swift in Sources */, - F3BA81181CFB305E003DC1BA /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + F3BA81181CFB305E003DC1BA /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, F3BA810A1CFB3056003DC1BA /* FoundationNSDateTests.swift in Sources */, 5657AB4D1D108BA9006283EF /* FoundationNSNullTests.swift in Sources */, 5627564A1E963AAC0035B653 /* DatabaseWriterTests.swift in Sources */, @@ -1868,7 +1868,7 @@ 5690C33E1D23E7D200E59934 /* FoundationDateTests.swift in Sources */, 567A805A1D41350C00C7DCEC /* IndexInfoTests.swift in Sources */, 5674A7291F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, - 56FEE8021F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE8021F47253700D930EA /* TableRecordTests.swift in Sources */, F3BA81211CFB3063003DC1BA /* RecordPrimaryKeyNoneTests.swift in Sources */, F3BA80F71CFB3021003DC1BA /* SelectStatementTests.swift in Sources */, 56F3E7501E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */, @@ -1984,7 +1984,7 @@ F3BA807C1CFB2E61003DC1BA /* Date.swift in Sources */, 56A8C2321D1914540096E9D4 /* UUID.swift in Sources */, 56BF6D311DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */, - 56D51D021EA789FA0074638A /* DecodableRecord+TableMapping.swift in Sources */, + 56D51D021EA789FA0074638A /* DecodableRecord+TableRecord.swift in Sources */, F3BA80711CFB2E55003DC1BA /* DatabaseWriter.swift in Sources */, F3BA80661CFB2E55003DC1BA /* Configuration.swift in Sources */, 566475BC1D981AD200FF74B8 /* SQLSpecificExpressible+QueryInterface.swift in Sources */, @@ -2018,7 +2018,7 @@ F3BA80881CFB2E70003DC1BA /* SQLCollatedExpression.swift in Sources */, 569A98F82039B716008D7DBF /* Fixits-3.0.swift in Sources */, F3BA808C1CFB2E75003DC1BA /* DatabaseMigrator.swift in Sources */, - F3BA80921CFB2E7A003DC1BA /* TableMapping.swift in Sources */, + F3BA80921CFB2E7A003DC1BA /* TableRecord.swift in Sources */, F3BA80831CFB2E67003DC1BA /* DatabaseValueConvertible+RawRepresentable.swift in Sources */, 568052092013207000E87861 /* RecordBox.swift in Sources */, 566475A41D9810A400FF74B8 /* SQLSelectable+QueryInterface.swift in Sources */, @@ -2062,7 +2062,7 @@ F3BA80F61CFB301E003DC1BA /* StatementColumnConvertibleFetchTests.swift in Sources */, F3BA80E61CFB3012003DC1BA /* DatabaseFunctionTests.swift in Sources */, 5698ACDA1DA925430056AF8C /* RowTestCase.swift in Sources */, - F3BA811D1CFB305F003DC1BA /* TableMapping+QueryInterfaceRequestTests.swift in Sources */, + F3BA811D1CFB305F003DC1BA /* TableRecord+QueryInterfaceRequestTests.swift in Sources */, F3BA80AD1CFB2FA6003DC1BA /* DataMemoryTests.swift in Sources */, 5698ACB91DA6285E0056AF8C /* FTS3TokenizerTests.swift in Sources */, 5674A7141F3087710095F066 /* DatabaseValueConvertibleDecodableTests.swift in Sources */, @@ -2115,7 +2115,7 @@ 5698AC061D9B9FCF0056AF8C /* QueryInterfaceExtensibilityTests.swift in Sources */, F3BA80FA1CFB3021003DC1BA /* SelectStatementTests.swift in Sources */, 5674A7271F30A9090095F066 /* DecodableRecordDecodableTests.swift in Sources */, - 56FEE7FE1F47253700D930EA /* TableMappingTests.swift in Sources */, + 56FEE7FE1F47253700D930EA /* TableRecordTests.swift in Sources */, F3BA81191CFB305F003DC1BA /* QueryInterfaceRequestTests.swift in Sources */, F3BA812F1CFB3064003DC1BA /* RecordPrimaryKeyNoneTests.swift in Sources */, 5690C33A1D23E7D200E59934 /* FoundationDateTests.swift in Sources */, diff --git a/Playgrounds/Issue156.playground/Contents.swift b/Playgrounds/Issue156.playground/Contents.swift index e34392e90..75e88bbaa 100644 --- a/Playgrounds/Issue156.playground/Contents.swift +++ b/Playgrounds/Issue156.playground/Contents.swift @@ -76,7 +76,7 @@ class TestDeleteAll: NSObject { } -struct MyRecord: DecodableRecord, TableMapping, Persistable { +struct MyRecord: DecodableRecord, TableRecord, Persistable { static let MyColumn = Column("MyColumn") static var databaseTableName: String { return String(describing: self) } diff --git a/Playgrounds/Tour.playground/Contents.swift b/Playgrounds/Tour.playground/Contents.swift index 3da4dc315..d500e5827 100644 --- a/Playgrounds/Tour.playground/Contents.swift +++ b/Playgrounds/Tour.playground/Contents.swift @@ -76,8 +76,8 @@ extension PointOfInterest : DecodableRecord { } } -// Adopt TableMapping -extension PointOfInterest : TableMapping { +// Adopt TableRecord +extension PointOfInterest : TableRecord { static let databaseTableName = "pointOfInterests" } diff --git a/README.md b/README.md index c60d193bb..be69c6671 100644 --- a/README.md +++ b/README.md @@ -1858,7 +1858,7 @@ Your custom structs and classes can adopt each protocol individually, and opt in - [Record Protocols Overview](#record-protocols-overview) - [DecodableRecord Protocol](#decodablerecord-protocol) -- [TableMapping Protocol](#tablemapping-protocol) +- [TableRecord Protocol](#tablerecord-protocol) - [Persistable Protocol](#persistable-protocol) - [Persistence Methods](#persistence-methods) - [Customizing the Persistence Methods](#customizing-the-persistence-methods) @@ -1891,7 +1891,7 @@ class Player : Record { ... } let players = try Player.fetchAll(db, "SELECT ...", arguments: ...) // [Player] ``` -Add the [TableMapping](#tablemapping-protocol) protocol and you can stop writing SQL: +Add the [TableRecord] protocol and you can stop writing SQL: ```swift let spain = try Country.fetchOne(db, key: "ES") // Country? @@ -1957,7 +1957,7 @@ try Player.filter(emailColumn == nil).deleteAll(db) ### Counting Records -[Record](#record-class) subclasses and types that adopt the [TableMapping](#tablemapping-protocol) protocol can be counted: +[Record](#record-class) subclasses and types that adopt the [TableRecord] protocol can be counted: ```swift let playerWithEmailCount = try Player.filter(emailColumn != nil).fetchCount(db) // Int @@ -1968,7 +1968,7 @@ Details follow: - [Record Protocols Overview](#record-protocols-overview) - [DecodableRecord Protocol](#decodablerecord-protocol) -- [TableMapping Protocol](#tablemapping-protocol) +- [TableRecord Protocol](#tablerecord-protocol) - [Persistable Protocol](#persistable-protocol) - [Codable Records](#codable-records) - [Record Class](#record-class) @@ -2051,20 +2051,20 @@ Details follow: } ``` - DecodableRecord is not able to build SQL requests, though. For that, you also need TableMapping: + DecodableRecord is not able to build SQL requests, though. For that, you also need TableRecord: -- [TableMapping](#tablemapping-protocol) is able to **build requests without SQL**: +- [TableRecord] is able to **build requests without SQL**: ```swift - struct Place : TableMapping { ... } + struct Place : TableRecord { ... } // SELECT * FROM places ORDER BY title let request = Place.order(Column("title")) ``` - When a type adopts both TableMapping and DecodableRecord, it can load from those requests: + When a type adopts both TableRecord and DecodableRecord, it can load from those requests: ```swift - struct Place : TableMapping, DecodableRecord { ... } + struct Place : TableRecord, DecodableRecord { ... } try dbQueue.inDatabase { db in let places = try Place.order(Column("title")).fetchAll(db) let paris = try Place.fetchOne(key: 1) @@ -2151,12 +2151,12 @@ try Place.fetchOne(db, "SELECT ...", arguments:...) // Place? See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.9/Structs/StatementArguments.html) for more information about the query arguments. -## TableMapping Protocol +## TableRecord Protocol -**Adopt the TableMapping protocol** on top of [DecodableRecord], and you are granted with the full [query interface](#the-query-interface). +**Adopt the TableRecord protocol** on top of [DecodableRecord], and you are granted with the full [query interface](#the-query-interface). ```swift -protocol TableMapping { +protocol TableRecord { static var databaseTableName: String { get } static var databaseSelection: [SQLSelectable] { get } } @@ -2164,10 +2164,10 @@ protocol TableMapping { The `databaseTableName` type property is the name of a database table. `databaseSelection` is optional, and documented in the [Columns Selected by a Request](#columns-selected-by-a-request) chapter. -**To use TableMapping**, subclass the [Record](#record-class) class, or adopt it explicitely. For example: +**To use TableRecord**, subclass the [Record](#record-class) class, or adopt it explicitely. For example: ```swift -extension Place : TableMapping { +extension Place : TableRecord { static let databaseTableName = "places" } ``` @@ -2179,7 +2179,7 @@ Adopting types can be fetched without SQL, using the [query interface](#the-quer let paris = try Place.filter(nameColumn == "Paris").fetchOne(db) ``` -TableMapping can also fetch records by primary key: +TableRecord can also fetch records by primary key: ```swift try Player.fetchOne(db, key: 1) // Player? @@ -2209,8 +2209,8 @@ try Citizenship.fetchOne(db, key: ["playerID": 1, "countryISOCode": "FR"]) // Ci **GRDB provides two protocols that let adopting types create, update, and delete rows in the database:** ```swift -protocol MutablePersistable : TableMapping { - /// The name of the database table (from TableMapping) +protocol MutablePersistable : TableRecord { + /// The name of the database table (from TableRecord) static var databaseTableName: String { get } /// Defines the values persisted in the database @@ -2479,7 +2479,7 @@ place.id // A unique id ## Record Class -**Record** is a class that is designed to be subclassed. It inherits its features from the [DecodableRecord, TableMapping, and Persistable](#record-protocols-overview) protocols. On top of that, Record instances can [track their changes](#changes-tracking). +**Record** is a class that is designed to be subclassed. It inherits its features from the [DecodableRecord, TableRecord, and Persistable](#record-protocols-overview) protocols. On top of that, Record instances can [track their changes](#changes-tracking). Record subclasses define their custom database relationship by overriding database methods: @@ -2710,10 +2710,10 @@ Without primary key, records don't have any identity, and the [persistence metho When SQLite won't let you provide an explicit primary key (as in [full-text](#full-text-search) tables, for example), you may want to make your record type fully aware of the hidden rowid column: -1. Have the `databaseSelection` static property (from the [TableMapping](#tablemapping-protocol) protocol) return the hidden rowid column: +1. Have the `databaseSelection` static property (from the [TableRecord] protocol) return the hidden rowid column: ```swift - struct Event : TableMapping { + struct Event : TableRecord { static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID] } @@ -2803,8 +2803,8 @@ This is the list of record methods, along with their required protocols. The [Re | ------ | --------- | :---: | | **Core Methods** | | | | `init(row:)` | [DecodableRecord] | | -| `Type.databaseTableName` | [TableMapping](#tablemapping-protocol) | | -| `Type.databaseSelection` | [TableMapping](#tablemapping-protocol) | [*](#columns-selected-by-a-request) | +| `Type.databaseTableName` | [TableRecord] | | +| `Type.databaseSelection` | [TableRecord] | [*](#columns-selected-by-a-request) | | `Type.persistenceConflictPolicy` | [Persistable](#persistable-protocol) | [*](#conflict-resolution) | | `record.encode(to:)` | [Persistable](#persistable-protocol) | | | `record.didInsert(with:for:)` | [Persistable](#persistable-protocol) | | @@ -2826,26 +2826,26 @@ This is the list of record methods, along with their required protocols. The [Re | **Convert Record to Dictionary** | | | | `record.databaseDictionary` | [Persistable](#persistable-protocol) | | | **Count Records** | | | -| `Type.fetchCount(db)` | [TableMapping](#tablemapping-protocol) | | -| `Type.filter(...).fetchCount(db)` | [TableMapping](#tablemapping-protocol) | ² | +| `Type.fetchCount(db)` | [TableRecord] | | +| `Type.filter(...).fetchCount(db)` | [TableRecord] | ² | | **Fetch Record [Cursors](#cursors)** | | | -| `Type.fetchCursor(db)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | | -| `Type.fetchCursor(db, keys:...)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | ¹ | +| `Type.fetchCursor(db)` | [DecodableRecord] & [TableRecord] | | +| `Type.fetchCursor(db, keys:...)` | [DecodableRecord] & [TableRecord] | ¹ | | `Type.fetchCursor(db, sql)` | [DecodableRecord] | ³ | | `Type.fetchCursor(statement)` | [DecodableRecord] | ⁴ | -| `Type.filter(...).fetchCursor(db)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | ² | +| `Type.filter(...).fetchCursor(db)` | [DecodableRecord] & [TableRecord] | ² | | **Fetch Record Arrays** | | | -| `Type.fetchAll(db)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | | -| `Type.fetchAll(db, keys:...)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | ¹ | +| `Type.fetchAll(db)` | [DecodableRecord] & [TableRecord] | | +| `Type.fetchAll(db, keys:...)` | [DecodableRecord] & [TableRecord] | ¹ | | `Type.fetchAll(db, sql)` | [DecodableRecord] | ³ | | `Type.fetchAll(statement)` | [DecodableRecord] | ⁴ | -| `Type.filter(...).fetchAll(db)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | ² | +| `Type.filter(...).fetchAll(db)` | [DecodableRecord] & [TableRecord] | ² | | **Fetch Individual Records** | | | -| `Type.fetchOne(db)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | | -| `Type.fetchOne(db, key:...)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | ¹ | +| `Type.fetchOne(db)` | [DecodableRecord] & [TableRecord] | | +| `Type.fetchOne(db, key:...)` | [DecodableRecord] & [TableRecord] | ¹ | | `Type.fetchOne(db, sql)` | [DecodableRecord] | ³ | | `Type.fetchOne(statement)` | [DecodableRecord] | ⁴ | -| `Type.filter(...).fetchOne(db)` | [DecodableRecord] & [TableMapping](#tablemapping-protocol) | ² | +| `Type.filter(...).fetchOne(db)` | [DecodableRecord] & [TableRecord] | ² | | **[Changes Tracking](#changes-tracking)** | | | | `record.databaseEqual(...)` | [Persistable](#persistable-protocol) | | | `record.databaseChanges(from:...)` | [Persistable](#persistable-protocol) | | @@ -3117,7 +3117,7 @@ let players = try request.fetchAll(db) // [Player] let count = try request.fetchCount(db) // Int ``` -All requests start from **a type** that adopts the `TableMapping` protocol, such as a `Record` subclass (see [Records](#records)): +All requests start from **a type** that adopts the `TableRecord` protocol, such as a `Record` subclass (see [Records](#records)): ```swift class Player : Record { ... } @@ -3309,12 +3309,12 @@ let request = Player.select(AllColumns(), Column.rowID) To specify the default selection for all requests built from a type, define the `databaseSelection` property: ```swift -struct RestrictedPlayer : TableMapping { +struct RestrictedPlayer : TableRecord { static let databaseTableName = "players" static let databaseSelection: [SQLSelectable] = [Column("id"), Column("name")] } -struct ExtendedPlayer : TableMapping { +struct ExtendedPlayer : TableRecord { static let databaseTableName = "players" static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID] } @@ -3701,7 +3701,7 @@ Player.deleteOne(db, key: ["email": "arthur@example.com"]) ## Custom Requests -Until now, we have seen [requests](#requests) created from any type that adopts the [TableMapping](#tablemapping-protocol) protocol: +Until now, we have seen [requests](#requests) created from any type that adopts the [TableRecord] protocol: ```swift let request = Player.all() // QueryInterfaceRequest @@ -4712,7 +4712,7 @@ Our introduction above has introduced important techniques. It uses [row adapter But we may want to make it more usable and robust: 1. It's generally easier to consume records than raw rows. -2. Joined records not always need all columns from a table (see `TableMapping.databaseSelection` in [Columns Selected by a Request](#columns-selected-by-a-request)). +2. Joined records not always need all columns from a table (see `TableRecord.databaseSelection` in [Columns Selected by a Request](#columns-selected-by-a-request)). 3. Building row adapters is long and error prone. To address the first bullet, let's define a record that holds our player, optional team, and maximum score. Since it can decode database rows, it adopts the [DecodableRecord] protocol: @@ -4893,12 +4893,12 @@ Item.all() You can consume complex joined queries with Codable records as well. As a demonstration, we'll rewrite the [above](#splitting-rows-the-request-way) sample code: ```swift -struct Player: Decodable, DecodableRecord, TableMapping { +struct Player: Decodable, DecodableRecord, TableRecord { static let databaseTableName = "players" var id: Int64 var name: String } -struct Team: Decodable, DecodableRecord, TableMapping { +struct Team: Decodable, DecodableRecord, TableRecord { static let databaseTableName = "teams" var id: Int64 var name: String @@ -5489,10 +5489,10 @@ try controller.performFetch() FetchedRecordsController let you feed table and collection views, and keep them up-to-date with the database content. -For nice animated updates, a fetched records controller needs to recognize identical records between two different result sets. When records adopt the [TableMapping](#tablemapping-protocol) protocol, they are automatically compared according to their primary key: +For nice animated updates, a fetched records controller needs to recognize identical records between two different result sets. When records adopt the [TableRecord] protocol, they are automatically compared according to their primary key: ```swift -class Player : TableMapping { ... } +class Player : TableRecord { ... } let controller = FetchedRecordsController( dbQueue, request: Player.all()) @@ -6916,8 +6916,13 @@ Sample Code Legacy ====== -## RowConvertible Protocol +#### RowConvertible Protocol This protocol has been renamed [DecodableRecord] in GRDB 3.0. +#### TableMapping Protocol + +This protocol has been renamed [TableRecord] in GRDB 3.0. + [DecodableRecord]: #decodablerecord-protocol +[TableRecord]: #tablerecord-protocol diff --git a/TODO.md b/TODO.md index 5fc8da458..3223fc981 100644 --- a/TODO.md +++ b/TODO.md @@ -30,7 +30,7 @@ GRDB 3.0 - [ ] Not sure: type safety - [ ] Introduce some record protocol with an associated primary key type. Restrict filter(key:) methods to this type. Allow distinguishing FooId from BarId types. - [ ] Replace Column with TypedColumn. How to avoid code duplication (repeated types)? Keypaths? -- [ ] Rename RowConvertible, TableMapping, MutablePersistable and Persistable so that their names contain Record: FetchableRecord, TableRecord, MutablePersistableRecord, PersistableRecord? +- [ ] Rename RowConvertible, TableRecord, MutablePersistable and Persistable so that their names contain Record: FetchableRecord, TableRecord, MutablePersistableRecord, PersistableRecord? - [ ] Not sure: Consider introducing RowDecodable and RowEncodable on top of FetchableRecord and MutablePersistableRecord. This would allow keeping fetching and persistence methods private in some files. - [X] Drop IteratorCursor, use AnyCursor instead - [X] Rename TypedRequest to FetchRequest, drop Request diff --git a/Tests/GRDBTests/CompilationProtocolTests.swift b/Tests/GRDBTests/CompilationProtocolTests.swift index f140b34d3..7a7f9c1e8 100644 --- a/Tests/GRDBTests/CompilationProtocolTests.swift +++ b/Tests/GRDBTests/CompilationProtocolTests.swift @@ -162,14 +162,14 @@ private class UserStatementColumnConvertible2 : StatementColumnConvertible { required init(sqliteStatement: SQLiteStatement, index: Int32) { } } -// MARK: - TableMapping +// MARK: - TableRecord -private struct UserTableMapping1 : TableMapping { - static let databaseTableName = "UserTableMapping1" +private struct UserTableRecord1 : TableRecord { + static let databaseTableName = "UserTableRecord1" } -private class UserTableMapping2 : TableMapping { - static let databaseTableName = "UserTableMapping2" +private class UserTableRecord2 : TableRecord { + static let databaseTableName = "UserTableRecord2" } // MARK: - TransactionObserver diff --git a/Tests/GRDBTests/DatabaseRegionTests.swift b/Tests/GRDBTests/DatabaseRegionTests.swift index 55406b398..bf56708d7 100644 --- a/Tests/GRDBTests/DatabaseRegionTests.swift +++ b/Tests/GRDBTests/DatabaseRegionTests.swift @@ -287,7 +287,7 @@ class DatabaseRegionTests : GRDBTestCase { let dbQueue = try makeDatabaseQueue() try dbQueue.inDatabase { db in try db.execute("CREATE TABLE foo (id INTEGER PRIMARY KEY, a TEXT)") - struct Record: TableMapping { + struct Record: TableRecord { static let databaseTableName = "foo" } @@ -414,7 +414,7 @@ class DatabaseRegionTests : GRDBTestCase { let dbQueue = try makeDatabaseQueue() try dbQueue.inDatabase { db in try db.execute("CREATE TABLE foo (id INTEGER PRIMARY KEY, a TEXT)") - struct Record: TableMapping { + struct Record: TableRecord { static let databaseTableName = "foo" } diff --git a/Tests/GRDBTests/JoinSupportTests.swift b/Tests/GRDBTests/JoinSupportTests.swift index b4c171fa5..bb638889e 100644 --- a/Tests/GRDBTests/JoinSupportTests.swift +++ b/Tests/GRDBTests/JoinSupportTests.swift @@ -41,33 +41,33 @@ let testedSQL = """ ORDER BY t1.id """ -private struct T1: Codable, DecodableRecord, TableMapping { +private struct T1: Codable, DecodableRecord, TableRecord { static let databaseTableName = "t1" var id: Int64 var name: String } -private struct T2: Codable, DecodableRecord, TableMapping { +private struct T2: Codable, DecodableRecord, TableRecord { static let databaseTableName = "t2" var id: Int64 var t1id: Int64 var name: String } -private struct T3: Codable, DecodableRecord, TableMapping { +private struct T3: Codable, DecodableRecord, TableRecord { static let databaseTableName = "t3" static let databaseSelection: [SQLSelectable] = [Column("t1id"), Column("name")] var t1id: Int64 var name: String } -private struct T4: Codable, DecodableRecord, TableMapping { +private struct T4: Codable, DecodableRecord, TableRecord { static let databaseTableName = "t4" var t1id: Int64 var name: String } -private struct T5: Codable, DecodableRecord, TableMapping { +private struct T5: Codable, DecodableRecord, TableRecord { static let databaseTableName = "t5" var id: Int64 var t3id: Int64? diff --git a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift index 2dbdfa946..988918f8d 100644 --- a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift +++ b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift @@ -14,7 +14,7 @@ private struct Col { static let readerId = Column("readerId") } -private struct Reader : TableMapping { +private struct Reader : TableRecord { static let databaseTableName = "readers" } private let tableRequest = Reader.all() diff --git a/Tests/GRDBTests/QueryInterfaceExtensibilityTests.swift b/Tests/GRDBTests/QueryInterfaceExtensibilityTests.swift index 235f64585..269d89fe0 100644 --- a/Tests/GRDBTests/QueryInterfaceExtensibilityTests.swift +++ b/Tests/GRDBTests/QueryInterfaceExtensibilityTests.swift @@ -60,7 +60,7 @@ class QueryInterfaceExtensibilityTests: GRDBTestCase { try db.create(table: "records") { t in t.column("date", .datetime) } - struct Record : TableMapping { + struct Record : TableRecord { static let databaseTableName = "records" } @@ -78,7 +78,7 @@ class QueryInterfaceExtensibilityTests: GRDBTestCase { let dbQueue = try makeDatabaseQueue() try dbQueue.inDatabase { db in try db.execute("CREATE VIRTUAL TABLE records USING fts3(content TEXT)") - struct Record : TableMapping { + struct Record : TableRecord { static let databaseTableName = "records" } @@ -98,7 +98,7 @@ class QueryInterfaceExtensibilityTests: GRDBTestCase { try db.create(table: "records") { t in t.column("text", .text) } - struct Record : TableMapping { + struct Record : TableRecord { static let databaseTableName = "records" } diff --git a/Tests/GRDBTests/QueryInterfaceRequestTests.swift b/Tests/GRDBTests/QueryInterfaceRequestTests.swift index f32069f12..00fdf0f94 100644 --- a/Tests/GRDBTests/QueryInterfaceRequestTests.swift +++ b/Tests/GRDBTests/QueryInterfaceRequestTests.swift @@ -14,7 +14,7 @@ private struct Col { static let readerId = Column("readerId") } -private struct Reader : TableMapping { +private struct Reader : TableRecord { static let databaseTableName = "readers" } private let tableRequest = Reader.all() diff --git a/Tests/GRDBTests/RecordUniqueIndexTests.swift b/Tests/GRDBTests/RecordUniqueIndexTests.swift index 9224d3ef6..2ffd67fe4 100644 --- a/Tests/GRDBTests/RecordUniqueIndexTests.swift +++ b/Tests/GRDBTests/RecordUniqueIndexTests.swift @@ -7,7 +7,7 @@ import XCTest @testable import GRDB #endif -private struct Person : DecodableRecord, TableMapping { +private struct Person : DecodableRecord, TableRecord { static let databaseTableName = "persons" init(row: Row) { } diff --git a/Tests/GRDBTests/TableMapping+QueryInterfaceRequestTests.swift b/Tests/GRDBTests/TableRecord+QueryInterfaceRequestTests.swift similarity index 99% rename from Tests/GRDBTests/TableMapping+QueryInterfaceRequestTests.swift rename to Tests/GRDBTests/TableRecord+QueryInterfaceRequestTests.swift index 88799416b..6448b5ad6 100644 --- a/Tests/GRDBTests/TableMapping+QueryInterfaceRequestTests.swift +++ b/Tests/GRDBTests/TableRecord+QueryInterfaceRequestTests.swift @@ -14,12 +14,12 @@ private struct Col { static let readerId = Column("readerId") } -private struct Reader : TableMapping { +private struct Reader : TableRecord { static let databaseTableName = "readers" } -class TableMappingQueryInterfaceRequestTests: GRDBTestCase { +class TableRecordQueryInterfaceRequestTests: GRDBTestCase { override func setup(_ dbWriter: DatabaseWriter) throws { var migrator = DatabaseMigrator() diff --git a/Tests/GRDBTests/TableMappingTests.swift b/Tests/GRDBTests/TableRecordTests.swift similarity index 90% rename from Tests/GRDBTests/TableMappingTests.swift rename to Tests/GRDBTests/TableRecordTests.swift index c310cf690..54ce6be41 100644 --- a/Tests/GRDBTests/TableMappingTests.swift +++ b/Tests/GRDBTests/TableRecordTests.swift @@ -7,10 +7,10 @@ import XCTest import GRDB #endif -class TableMappingTests: GRDBTestCase { +class TableRecordTests: GRDBTestCase { func testDefaultDatabaseSelection() throws { - struct Record: TableMapping { + struct Record: TableRecord { static let databaseTableName = "t1" } let dbQueue = try makeDatabaseQueue() @@ -22,7 +22,7 @@ class TableMappingTests: GRDBTestCase { } func testExtendedDatabaseSelection() throws { - struct Record: TableMapping { + struct Record: TableRecord { static let databaseTableName = "t1" static let databaseSelection: [SQLSelectable] = [AllColumns(), Column.rowID] } @@ -35,7 +35,7 @@ class TableMappingTests: GRDBTestCase { } func testRestrictedDatabaseSelection() throws { - struct Record: TableMapping { + struct Record: TableRecord { static let databaseTableName = "t1" static let databaseSelection: [SQLSelectable] = [Column("a"), Column("b")] } diff --git a/Tests/generatePerformanceReport.rb b/Tests/generatePerformanceReport.rb index 84de5e2ff..d44ba94fb 100755 --- a/Tests/generatePerformanceReport.rb +++ b/Tests/generatePerformanceReport.rb @@ -103,7 +103,7 @@ As a bottom line, the raw SQLite C API is used as efficiently as possible, witho This test fetches an array of 100000 record objects initiated from rows of 10 ints. - It builds records from FMDB's `-[FMResultSet resultDictionary]`, GRDB's built-in [DecodableRecord](https://github.com/groue/GRDB.swift#rowconvertible-protocol) protocol, and the values returned by the high-level query builder of SQLite.swift. + It builds records from FMDB's `-[FMResultSet resultDictionary]`, GRDB's built-in [DecodableRecord](https://github.com/groue/GRDB.swift#decodablerecord-protocol) protocol, and the values returned by the high-level query builder of SQLite.swift. - **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertRecordStructTests.swift))