|
9 | 9 | <string>All</string>
|
10 | 10 | </array>
|
11 | 11 | <key>IDECodeSnippetContents</key>
|
12 |
| - <string>class <#Class name#>: WCDBSwift.TableCodable { |
| 12 | + <string>class <#Class name#>: WCDB.TableCodable { |
13 | 13 | //Your own properties
|
14 |
| - var variable1: Int = 0 |
| 14 | + var variable1: Int = 0 |
15 | 15 | var variable2: String? // Optional if it would be nil in some WCDB selection.
|
16 | 16 | var variable3: Double? // Optional if it would be nil in some WCDB selection.
|
17 | 17 | let invalid: Int = 0 // An initialized constant property is not allowed.
|
18 | 18 | let unbound: Date? = nil
|
19 | 19 |
|
20 | 20 | enum CodingKeys: String, CodingTableKey {
|
21 |
| - typealias Root = <#Class name#> |
| 21 | + typealias Root = Temp; |
22 | 22 |
|
23 | 23 | //List the properties which should be bound to table.
|
24 | 24 | case variable1 = "custom_name"
|
25 | 25 | case variable2
|
26 | 26 | case variable3
|
27 | 27 |
|
28 |
| - static let objectRelationalMapping = TableBinding(CodingKeys.self) |
29 |
| - |
30 |
| - //Column constraints for primary key, unique, not null, default value and so on. It is optional. |
31 |
| - //static var columnConstraintBindings: [CodingKeys: ColumnConstraintBinding]? { |
32 |
| - // return [ |
33 |
| - // .variable1: ColumnConstraintBinding(isPrimary: true, isAutoIncrement: true), |
34 |
| - // .variable2: ColumnConstraintBinding(isUnique: true) |
35 |
| - // ] |
36 |
| - //} |
37 |
| - |
38 |
| - //Index bindings. It is optional. |
39 |
| - //static var indexBindings: [IndexBinding.Subfix: IndexBinding]? { |
40 |
| - // return [ |
41 |
| - // "_index": IndexBinding(indexesBy: CodingKeys.variable2) |
42 |
| - // ] |
43 |
| - //} |
44 |
| - |
45 |
| - //Table constraints for multi-primary, multi-unique and so on. It is optional. |
46 |
| - //static var tableConstraintBindings: [TableConstraintBinding.Name: TableConstraintBinding]? { |
47 |
| - // return [ |
48 |
| - // "MultiPrimaryConstraint": MultiPrimaryBinding(indexesBy: variable2.asIndex(orderBy: .descending), variable3.primaryKeyPart2) |
49 |
| - // ] |
50 |
| - //} |
51 |
| - |
52 |
| - //Virtual table binding for FTS and so on. It is optional. |
53 |
| - //static var virtualTableBinding: VirtualTableBinding? { |
54 |
| - // return VirtualTableBinding(with: .fts3, and: ModuleArgument(with: .WCDB)) |
55 |
| - //} |
| 28 | + static let objectRelationalMapping = TableBinding(CodingKeys.self) { |
| 29 | + //Column constraints for primary key, unique, not null, default value and so on. It is optional. |
| 30 | + //BindColumnConstraint(.variable1, isPrimary: true, isAutoIncrement: true) |
| 31 | + //BindColumnConstraint(.variable2, isUnique: true) |
| 32 | + |
| 33 | + //Index bindings. It is optional. |
| 34 | + //BindIndex(.variable2, namedWith: "_index") |
| 35 | + |
| 36 | + //Table constraints for multi-primary, multi-unique and so on. It is optional. |
| 37 | + //BindMultiPrimary(.variable2, .variable3) |
| 38 | + |
| 39 | + //Virtual table binding for FTS and so on. It is optional. |
| 40 | + //BindVirtualTable(withModule: .FTS5, and: BuiltinTokenizer.Verbatim) |
| 41 | + } |
56 | 42 | }
|
57 | 43 |
|
58 | 44 | //Properties below are needed when the primary key is auto-increment.
|
|
0 commit comments