mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
One availability per JSON function
This commit is contained in:
1 parent
c4c13b6f53
commit
85792b8293
2 files changed
+27
-3
No files matched your search
@@ -386,7 +386,6 @@ extension Database {
|
||||
}
|
||||
}
|
||||
#else
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
extension Database {
|
||||
/// Validates and minifies a JSON string, with the `JSON` SQL function.
|
||||
///
|
||||
@@ -398,6 +397,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jmini>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func json(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON", [value.sqlExpression])
|
||||
}
|
||||
@@ -412,6 +412,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jarray>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonArray<C>(_ values: C) -> SQLExpression
|
||||
where C: Collection, C.Element: SQLExpressible
|
||||
{
|
||||
@@ -428,6 +429,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jarray>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonArray<C>(_ values: C) -> SQLExpression
|
||||
where C: Collection, C.Element == any SQLExpressible
|
||||
{
|
||||
@@ -445,6 +447,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jarraylen>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonArrayLength(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_ARRAY_LENGTH", [value.sqlExpression])
|
||||
}
|
||||
@@ -464,6 +467,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON array.
|
||||
/// - path: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonArrayLength(
|
||||
_ value: some SQLExpressible,
|
||||
atPath path: some SQLExpressible)
|
||||
@@ -501,6 +505,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - path: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonExtract(_ value: some SQLExpressible, atPath path: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_EXTRACT", [value.sqlExpression, path.sqlExpression])
|
||||
}
|
||||
@@ -519,6 +524,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - paths: A collection of [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonExtract<C>(_ value: some SQLExpressible, atPaths paths: C)
|
||||
-> SQLExpression
|
||||
where C: Collection, C.Element: SQLExpressible
|
||||
@@ -541,6 +547,7 @@ extension Database {
|
||||
/// - value: A JSON value.
|
||||
/// - assignments: A collection of key/value pairs, where keys are
|
||||
/// [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonInsert<C>(
|
||||
_ value: some SQLExpressible,
|
||||
_ assignments: C)
|
||||
@@ -568,6 +575,7 @@ extension Database {
|
||||
/// - value: A JSON value.
|
||||
/// - assignments: A collection of key/value pairs, where keys are
|
||||
/// [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonReplace<C>(
|
||||
_ value: some SQLExpressible,
|
||||
_ assignments: C)
|
||||
@@ -595,6 +603,7 @@ extension Database {
|
||||
/// - value: A JSON value.
|
||||
/// - assignments: A collection of key/value pairs, where keys are
|
||||
/// [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonSet<C>(
|
||||
_ value: some SQLExpressible,
|
||||
_ assignments: C)
|
||||
@@ -630,6 +639,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jobj>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonObject<C>(_ elements: C)
|
||||
-> SQLExpression
|
||||
where C: Collection,
|
||||
@@ -650,6 +660,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jpatch>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonPatch(
|
||||
_ value: some SQLExpressible,
|
||||
with patch: some SQLExpressible)
|
||||
@@ -672,6 +683,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - paths: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonRemove(_ value: some SQLExpressible, atPath path: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_REMOVE", [value.sqlExpression, path.sqlExpression])
|
||||
}
|
||||
@@ -690,6 +702,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - paths: A collection of [JSON paths](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonRemove<C>(_ value: some SQLExpressible, atPaths paths: C)
|
||||
-> SQLExpression
|
||||
where C: Collection, C.Element: SQLExpressible
|
||||
@@ -707,6 +720,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jtype>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonType(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_TYPE", [value.sqlExpression])
|
||||
}
|
||||
@@ -725,6 +739,7 @@ extension Database {
|
||||
/// - Parameters:
|
||||
/// - value: A JSON value.
|
||||
/// - paths: A [JSON path](https://www.sqlite.org/json1.html#path_arguments).
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonType(_ value: some SQLExpressible, atPath path: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_TYPE", [value.sqlExpression, path.sqlExpression])
|
||||
}
|
||||
@@ -739,6 +754,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jvalid>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonIsValid(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_VALID", [value.sqlExpression])
|
||||
}
|
||||
@@ -756,6 +772,7 @@ extension Database {
|
||||
/// ```
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jquote>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonQuote(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_QUOTE", [value.sqlExpression.jsonBuilderExpression])
|
||||
}
|
||||
@@ -763,6 +780,7 @@ extension Database {
|
||||
/// The `JSON_GROUP_ARRAY` SQL function.
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jgrouparray>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonGroupArray(_ value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_GROUP_ARRAY", [value.sqlExpression.jsonBuilderExpression])
|
||||
}
|
||||
@@ -770,6 +788,7 @@ extension Database {
|
||||
/// The `JSON_GROUP_OBJECT` SQL function.
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/json1.html#jgrouparray>
|
||||
@available(iOS 16, macOS 13.2, tvOS 17, watchOS 9, *) // SQLite 3.38+
|
||||
public static func jsonGroupObject(key: some SQLExpressible, value: some SQLExpressible) -> SQLExpression {
|
||||
.function("JSON_GROUP_OBJECT", [key.sqlExpression, value.sqlExpression.jsonBuilderExpression])
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user