File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
StructuredQueriesSQLiteCore Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 11import StructuredQueriesSQLiteCore
22
3+ /// Defines and implements a conformance to the ``/StructuredQueriesSQLiteCore/DatabaseFunction``
4+ /// protocol.
5+ ///
6+ /// - Parameters
7+ /// - name: The function's name. Defaults to the name of the function the macro is applied to.
8+ /// - isDeterministic: Whether or not the function is deterministic (or "pure" or "referentially
9+ /// transparent"), _i.e._ given an input it will always return the same output.
310@attached ( peer, names: overloaded, prefixed ( `$`) )
411public macro DatabaseFunction(
512 _ name: String = " " ,
Original file line number Diff line number Diff line change 1+ /// A type representing a database function.
2+ ///
3+ /// Don't conform to this protocol directly. Instead, use the `@DatabaseFunction` macros to
4+ /// generate a conformance.
15public protocol DatabaseFunction {
6+ /// The name of the function.
27 var name : String { get }
8+
9+ /// The number of arguments the function accepts.
310 var argumentCount : Int ? { get }
11+
12+ /// Whether or not the function is deterministic (or "pure" or "referentially transparent"),
13+ /// _i.e._ given an input it will always return the same output.
414 var isDeterministic : Bool { get }
15+
16+ /// The function body. Transforms a collection of bindings handed to the function into a binding
17+ /// returned to the query.
18+ ///
19+ /// - Parameter arguments: Arguments passed to the database function.
20+ /// - Returns: A value returned from the database function.
521 func invoke( _ arguments: [ QueryBinding ] ) -> QueryBinding
622}
You can’t perform that action at this time.
0 commit comments