diff --git a/Sources/StructuredQueriesSQLiteCore/DatabaseFunction.swift b/Sources/StructuredQueriesSQLiteCore/DatabaseFunction.swift
index 14df554b..5b0b41fb 100644
--- a/Sources/StructuredQueriesSQLiteCore/DatabaseFunction.swift
+++ b/Sources/StructuredQueriesSQLiteCore/DatabaseFunction.swift
@@ -9,6 +9,8 @@ public protocol DatabaseFunction {
/// A type representing the function's return value.
associatedtype Output
+ associatedtype SwiftFunction
+
/// The name of the function.
var name: String { get }
@@ -18,6 +20,8 @@ public protocol DatabaseFunction {
/// Whether or not the function is deterministic (or "pure" or "referentially transparent"),
/// _i.e._ given an input it will always return the same output.
var isDeterministic: Bool { get }
+
+ var body: SwiftFunction { get }
}
/// A type representing a scalar database function.
@@ -47,4 +51,8 @@ extension ScalarDatabaseFunction {
"\(quote: name)(\(Array(repeat each input).joined(separator: ", ")))"
)
}
+
+ public var wrappedValue: SwiftFunction {
+ body
+ }
}
diff --git a/Tests/StructuredQueriesTests/DatabaseFunctionTests.swift b/Tests/StructuredQueriesTests/DatabaseFunctionTests.swift
index ae300f41..36c3c211 100644
--- a/Tests/StructuredQueriesTests/DatabaseFunctionTests.swift
+++ b/Tests/StructuredQueriesTests/DatabaseFunctionTests.swift
@@ -31,6 +31,7 @@ extension SnapshotTests {
└──────┘
"""
}
+ #expect($isEnabled.wrappedValue())
}
@DatabaseFunction