File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ let package = Package(
1414 ] ,
1515 dependencies: [
1616 . package ( url: " https://github.com/vapor/postgres-nio.git " , from: " 1.14.2 " ) ,
17- . package ( url: " https://github.com/vapor/sql-kit.git " , from: " 3.26 .0 " ) ,
17+ . package ( url: " https://github.com/vapor/sql-kit.git " , from: " 3.28 .0 " ) ,
1818 . package ( url: " https://github.com/vapor/async-kit.git " , from: " 1.14.0 " ) ,
1919 . package ( url: " https://github.com/apple/swift-atomics.git " , from: " 1.1.0 " )
2020 ] ,
Original file line number Diff line number Diff line change @@ -54,4 +54,19 @@ public struct PostgresDialect: SQLDialect {
5454 public var sharedSelectLockExpression : ( any SQLExpression ) ? { SQLRaw ( " FOR SHARE " ) }
5555
5656 public var exclusiveSelectLockExpression : ( any SQLExpression ) ? { SQLRaw ( " FOR UPDATE " ) }
57+
58+ public func nestedSubpathExpression( in column: any SQLExpression , for path: [ String ] ) -> ( any SQLExpression ) ? {
59+ guard !path. isEmpty else { return nil }
60+
61+ let descender = SQLList (
62+ [ column] + path. dropLast ( ) . map ( SQLLiteral . string ( _: ) ) ,
63+ separator: SQLRaw ( " -> " )
64+ )
65+ let accessor = SQLList (
66+ [ descender, SQLLiteral . string ( path. last!) ] ,
67+ separator: SQLRaw ( " ->> " )
68+ )
69+
70+ return SQLGroupExpression ( accessor)
71+ }
5772}
You can’t perform that action at this time.
0 commit comments