File tree Expand file tree Collapse file tree 1 file changed +36
-2
lines changed
Tests/StructuredQueriesTests Expand file tree Collapse file tree 1 file changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -476,6 +476,36 @@ extension SnapshotTests {
476476 }
477477 }
478478
479+ @Test func upsertRepresentation( ) {
480+ assertQuery (
481+ Item . insert {
482+ $0. notes
483+ } values: {
484+ [ " Hello " , " World " ]
485+ } onConflictDoUpdate: {
486+ $0. notes = [ " Goodnight " , " Moon " ]
487+ }
488+ ) {
489+ """
490+ INSERT INTO " items "
491+ ( " notes " )
492+ VALUES
493+ ('[
494+ " Hello " ,
495+ " World "
496+ ]')
497+ ON CONFLICT DO UPDATE SET " notes " = '[
498+ " Goodnight " ,
499+ " Moon "
500+ ]'
501+ """
502+ } results: {
503+ """
504+ no such table: items
505+ """
506+ }
507+ }
508+
479509 @Test func sql( ) {
480510 assertQuery (
481511 #sql(
@@ -537,9 +567,11 @@ extension SnapshotTests {
537567 ) {
538568 """
539569 INSERT INTO " items "
540- ( " title " , " quantity " )
570+ ( " title " , " quantity " , " notes " )
541571 VALUES
542- ('', 0)
572+ ('', 0, '[
573+
574+ ]')
543575 """
544576 }
545577 }
@@ -642,4 +674,6 @@ extension SnapshotTests {
642674@Table private struct Item {
643675 var title = " "
644676 var quantity = 0
677+ @Column ( as: [ String ] . JSONRepresentation. self)
678+ var notes : [ String ] = [ ]
645679}
You can’t perform that action at this time.
0 commit comments