@@ -9,6 +9,9 @@ public protocol TableColumnExpression<Root, Value>: QueryExpression where Value
99 /// The name of the table column.
1010 var name : String { get }
1111
12+ /// The default value of the table column.
13+ var defaultValue : Value . QueryOutput ? { get }
14+
1215 /// The table model key path associated with this table column.
1316 var keyPath : KeyPath < Root , Value . QueryOutput > { get }
1417
@@ -24,10 +27,13 @@ public protocol TableColumnExpression<Root, Value>: QueryExpression where Value
2427public struct TableColumn < Root: Table , Value: QueryRepresentable & QueryBindable > :
2528 TableColumnExpression ,
2629 Sendable
27- {
30+ where Value . QueryOutput : Sendable {
2831 public typealias QueryValue = Value
2932
3033 public let name : String
34+
35+ public let defaultValue : Value . QueryOutput ?
36+
3137 let _keyPath : KeyPath < Root , Value . QueryOutput > & Sendable
3238
3339 public var keyPath : KeyPath < Root , Value . QueryOutput > {
@@ -37,18 +43,20 @@ public struct TableColumn<Root: Table, Value: QueryRepresentable & QueryBindable
3743 public init (
3844 _ name: String ,
3945 keyPath: KeyPath < Root , Value . QueryOutput > & Sendable ,
40- default: Value . QueryOutput ? = nil
46+ default defaultValue : Value . QueryOutput ? = nil
4147 ) {
4248 self . name = name
49+ self . defaultValue = defaultValue
4350 self . _keyPath = keyPath
4451 }
4552
4653 public init (
4754 _ name: String ,
4855 keyPath: KeyPath < Root , Value . QueryOutput > & Sendable ,
49- default: Value ? = nil
56+ default defaultValue : Value ? = nil
5057 ) where Value == Value . QueryOutput {
5158 self . name = name
59+ self . defaultValue = defaultValue
5260 self . _keyPath = keyPath
5361 }
5462
0 commit comments