Skip to content

Commit 325579d

Browse files
committed
Merge remote-tracking branch 'origin/main' into AssertQuery_Bug
2 parents 1f67b8f + ec9a634 commit 325579d

File tree

60 files changed

+3029
-1169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3029
-1169
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
strategy:
3535
matrix:
3636
swift:
37+
- '6.0'
3738
- '6.1'
3839
runs-on: ubuntu-latest
3940
container: swift:${{ matrix.swift }}

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/Packages
44
xcuserdata/
55
DerivedData/
6-
.swiftpm/configuration/registries.json
7-
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
6+
.swiftpm
87
.netrc
98
Package.resolved
10-
db.sqlite
9+
*.sqlite

.swiftpm/xcode/xcshareddata/xcschemes/StructuredQueries.xcscheme

Lines changed: 0 additions & 67 deletions
This file was deleted.

.swiftpm/xcode/xcshareddata/xcschemes/StructuredQueriesCore.xcscheme

Lines changed: 0 additions & 67 deletions
This file was deleted.

.swiftpm/xcode/xcshareddata/xcschemes/swift-structured-queries-Package.xcscheme

Lines changed: 0 additions & 141 deletions
This file was deleted.

Sources/StructuredQueries/Macros.swift

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,19 @@ import StructuredQueriesCore
99
conformances: Table,
1010
PartialSelectStatement,
1111
PrimaryKeyedTable,
12-
names: named(TableColumns),
13-
named(From),
14-
named(Draft),
12+
names: named(From),
1513
named(columns),
1614
named(init(_:)),
1715
named(init(decoder:)),
1816
named(QueryValue),
1917
named(schemaName),
2018
named(tableName)
2119
)
22-
@attached(
23-
memberAttribute
24-
)
20+
@attached(member, names: named(Draft), named(TableColumns))
21+
@attached(memberAttribute)
2522
public macro Table(
26-
_ name: String? = nil,
27-
schema schemaName: String? = nil
23+
_ name: String = "",
24+
schema schemaName: String = ""
2825
) =
2926
#externalMacro(
3027
module: "StructuredQueriesMacros",
@@ -38,9 +35,9 @@ public macro Table(
3835
/// - representableType: A type that represents the property type in a query expression. For types
3936
/// that don't have a single representation in SQL, like `Date` and `UUID`.
4037
/// - primaryKey: The column is its table's auto-incrementing primary key.
41-
@attached(accessor, names: named(willSet))
38+
@attached(peer)
4239
public macro Column(
43-
_ name: String? = nil,
40+
_ name: String = "",
4441
as representableType: (any QueryRepresentable.Type)? = nil,
4542
primaryKey: Bool = false
4643
) =
@@ -52,7 +49,7 @@ public macro Column(
5249
/// Tells Structured Queries not to consider the annotated property a column of the table
5350
///
5451
/// Like SwiftData's `@Transient` macro, but for SQL.
55-
@attached(accessor, names: named(willSet))
52+
@attached(peer)
5653
public macro Ephemeral() =
5754
#externalMacro(
5855
module: "StructuredQueriesMacros",
@@ -95,6 +92,7 @@ public macro Ephemeral() =
9592
names: named(Columns),
9693
named(init(decoder:))
9794
)
95+
@attached(member, names: named(Columns))
9896
public macro Selection() =
9997
#externalMacro(
10098
module: "StructuredQueriesMacros",
@@ -135,21 +133,9 @@ public macro sql<QueryValue>(
135133
) -> SQLQueryExpression<QueryValue> =
136134
#externalMacro(module: "StructuredQueriesMacros", type: "SQLMacro")
137135

138-
// NB: Due to a bug in Swift, this macro is expanded internally by the '@Table' macro.
139-
// @attached(
140-
// memberAttribute
141-
// )
142-
// @attached(
143-
// extension,
144-
// conformances: Table,
145-
// names: named(TableColumns),
146-
// named(columns),
147-
// named(init(_:)),
148-
// named(init(decoder:)),
149-
// named(tableName)
150-
// )
151-
// public macro _Draft<T: Table>(_: T.Type) =
152-
// #externalMacro(
153-
// module: "StructuredQueriesMacros",
154-
// type: "TableMacro"
155-
// )
136+
@freestanding(expression)
137+
public macro sql(
138+
_ queryFragment: QueryFragment,
139+
as queryValueType: Any.Type = Any.self
140+
) -> SQLQueryExpression<Any> =
141+
#externalMacro(module: "StructuredQueriesMacros", type: "SQLMacro")

0 commit comments

Comments
 (0)