mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
1626 lines
76 KiB
HTML
1626 lines
76 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<title>Protocols Reference</title>
|
||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||
<meta charset='utf-8'>
|
||
<script src="js/jquery.min.js" defer></script>
|
||
<script src="js/jazzy.js" defer></script>
|
||
|
||
</head>
|
||
<body>
|
||
<a title="Protocols Reference"></a>
|
||
<header>
|
||
<div class="content-wrapper">
|
||
<p><a href="index.html">GRDB Docs</a> (89% documented)</p>
|
||
<p class="header-right"><a href="https://github.com/groue/GRDB.swift"><img src="img/gh.png"/>View on GitHub</a></p>
|
||
<p class="header-right"><a href="dash-feed://http%3A%2F%2Fgroue%2Egithub%2Eio%2FGRDB%2Eswift%2Fdocs%2F2%2E7%2Fdocsets%2FGRDB%2Exml"><img src="img/dash.png"/>Install in Dash</a></p>
|
||
</div>
|
||
</header>
|
||
<div class="content-wrapper">
|
||
<p id="breadcrumbs">
|
||
<a href="index.html">GRDB Reference</a>
|
||
<img id="carat" src="img/carat.png" />
|
||
Protocols Reference
|
||
</p>
|
||
</div>
|
||
<div class="content-wrapper">
|
||
<nav class="sidebar">
|
||
<ul class="nav-groups">
|
||
<li class="nav-group-name">
|
||
<a href="Classes.html">Classes</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Classes/AnyCursor.html">AnyCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/AnyDatabaseReader.html">AnyDatabaseReader</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/AnyDatabaseWriter.html">AnyDatabaseWriter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB12ColumnCursorC">ColumnCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/ColumnDefinition.html">ColumnDefinition</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database.html">Database</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/BusyMode.html">– BusyMode</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/CheckpointMode.html">– CheckpointMode</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/CollationName.html">– CollationName</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/ColumnType.html">– ColumnType</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/ConflictResolution.html">– ConflictResolution</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/ForeignKeyAction.html">– ForeignKeyAction</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/TransactionCompletion.html">– TransactionCompletion</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/TransactionKind.html">– TransactionKind</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Database/TransactionObservationExtent.html">– TransactionObservationExtent</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/DatabaseCollation.html">DatabaseCollation</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/DatabaseFunction.html">DatabaseFunction</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/DatabasePool.html">DatabasePool</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/DatabaseQueue.html">DatabaseQueue</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB19DatabaseValueCursorC">DatabaseValueCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB16EnumeratedCursorC">EnumeratedCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/FTS3TableDefinition.html">FTS3TableDefinition</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/FTS4ColumnDefinition.html">FTS4ColumnDefinition</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/FTS4TableDefinition.html">FTS4TableDefinition</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/FTS5ColumnDefinition.html">FTS5ColumnDefinition</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/FTS5TableDefinition.html">FTS5TableDefinition</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/FetchedRecordsController.html">FetchedRecordsController</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB12FilterCursorC">FilterCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB13FlattenCursorC">FlattenCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/IteratorCursor.html">IteratorCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB9MapCursorC">MapCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB20NullableColumnCursorC">NullableColumnCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB27NullableDatabaseValueCursorC">NullableDatabaseValueCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Record.html">Record</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/RecordBox.html">RecordBox</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes.html#/s:4GRDB12RecordCursorC">RecordCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Row.html">Row</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/RowCursor.html">RowCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/SelectStatement.html">SelectStatement</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/Statement.html">Statement</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/StatementCursor.html">StatementCursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/TableAlteration.html">TableAlteration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/TableDefinition.html">TableDefinition</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Classes/UpdateStatement.html">UpdateStatement</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a href="Enums.html">Enumerations</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Enums/DatabaseEventKind.html">DatabaseEventKind</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Enums/FetchedRecordChange.html">FetchedRecordChange</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Enums/PersistenceError.html">PersistenceError</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a href="Extensions.html">Extensions</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Array.html">Array</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Bool.html">Bool</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/CGFloat.html">CGFloat</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/ClosedRange.html">ClosedRange</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Column.html">Column</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/CountableClosedRange.html">CountableClosedRange</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/CountableRange.html">CountableRange</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Data.html">Data</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Database.html">Database</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/DatabasePool.html">DatabasePool</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/DatabaseQueue.html">DatabaseQueue</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Date.html">Date</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Double.html">Double</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Float.html">Float</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Int.html">Int</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Int16.html">Int16</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Int32.html">Int32</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Int64.html">Int64</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Int8.html">Int8</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/NSData.html">NSData</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/NSDate.html">NSDate</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/NSNull.html">NSNull</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/NSNumber.html">NSNumber</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/NSString.html">NSString</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/NSURL.html">NSURL</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/NSUUID.html">NSUUID</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Optional.html">Optional</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/QueryInterfaceRequest.html">QueryInterfaceRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Range.html">Range</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/SQLCollection.html">SQLCollection</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/SQLSpecificExpressible.html">SQLSpecificExpressible</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Sequence.html">Sequence</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/Set.html">Set</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/String.html">String</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/TableMapping.html">TableMapping</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/UInt.html">UInt</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/UInt16.html">UInt16</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/UInt32.html">UInt32</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/UInt64.html">UInt64</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Extensions/UInt8.html">UInt8</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a href="Functions.html">Functions</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1nopAA13SQLExpression_pAA22SQLSpecificExpressible_pF">!(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2neoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA21SQLCollatedExpressionVtF">!=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2neoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA22SQLSpecificExpressible_ptF">!=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2neoiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_pSgtF">!=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2neoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_pSgtF">!=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2neoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">!=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2neoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_SbtF">!=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2neoiAA13SQLExpression_pSb_AA22SQLSpecificExpressible_ptF">!=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3neeoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA21SQLCollatedExpressionVtF">!==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3neeoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA22SQLSpecificExpressible_ptF">!==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3neeoiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_pSgtF">!==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3neeoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_pSgtF">!==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3neeoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">!==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2aaoiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">&&(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2aaoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">&&(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2aaoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">&&(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1moiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">*(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1moiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">*(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1moiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">*(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1poiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">+(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1poiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">+(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1poiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">+(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1sopAA13SQLExpression_pAA22SQLSpecificExpressible_pF">-(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1soiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">-(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1soiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">-(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1soiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">-(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1doiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">/(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1doiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">/(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1doiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">/(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1loiAA13SQLExpression_pAA14SQLExpressible_p_AA21SQLCollatedExpressionVtF"><(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1loiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF"><(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1loiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_ptF"><(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1loiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF"><(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1loiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF"><(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2leoiAA13SQLExpression_pAA14SQLExpressible_p_AA21SQLCollatedExpressionVtF"><=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2leoiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF"><=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2leoiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_ptF"><=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2leoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF"><=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2leoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF"><=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2eeoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA21SQLCollatedExpressionVtF">==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2eeoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA22SQLSpecificExpressible_ptF">==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2eeoiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_pSgtF">==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2eeoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_pSgtF">==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2eeoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2eeoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_SbtF">==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2eeoiAA13SQLExpression_pSb_AA22SQLSpecificExpressible_ptF">==(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3eeeoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA21SQLCollatedExpressionVtF">===(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3eeeoiAA13SQLExpression_pAA14SQLExpressible_pSg_AA22SQLSpecificExpressible_ptF">===(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3eeeoiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_pSgtF">===(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3eeeoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_pSgtF">===(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3eeeoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">===(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1goiAA13SQLExpression_pAA14SQLExpressible_p_AA21SQLCollatedExpressionVtF">>(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1goiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">>(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1goiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_ptF">>(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1goiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">>(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB1goiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">>(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2geoiAA13SQLExpression_pAA14SQLExpressible_p_AA21SQLCollatedExpressionVtF">>=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2geoiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">>=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2geoiAA13SQLExpression_pAA21SQLCollatedExpressionV_AA14SQLExpressible_ptF">>=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2geoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">>=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2geoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">>=(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2qqoiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">??(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3absAA13SQLExpression_pAA22SQLSpecificExpressible_pF">abs(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB7averageAA13SQLExpression_pAA22SQLSpecificExpressible_pF">average(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB5countAA13SQLExpression_pAA13SQLSelectable_pF">count(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB5countAA13SQLExpression_pAA22SQLSpecificExpressible_p8distinct_tF">count(distinct:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB21databaseQuestionMarksSSSi5count_tF">databaseQuestionMarks(count:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB6lengthAA13SQLExpression_pAA22SQLSpecificExpressible_pF">length(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3maxAA13SQLExpression_pAA22SQLSpecificExpressible_pF">max(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3minAA13SQLExpression_pAA22SQLSpecificExpressible_pF">min(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB3sumAA13SQLExpression_pAA22SQLSpecificExpressible_pF">sum(_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2oooiAA13SQLExpression_pAA14SQLExpressible_p_AA22SQLSpecificExpressible_ptF">||(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2oooiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AA14SQLExpressible_ptF">||(_:_:)</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Functions.html#/s:4GRDB2oooiAA13SQLExpression_pAA22SQLSpecificExpressible_p_AaD_ptF">||(_:_:)</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a href="Protocols.html">Protocols</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/Cursor.html">Cursor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/DatabaseAggregate.html">DatabaseAggregate</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/DatabaseReader.html">DatabaseReader</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/DatabaseValueConvertible.html">DatabaseValueConvertible</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/DatabaseWriter.html">DatabaseWriter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/FTS5CustomTokenizer.html">FTS5CustomTokenizer</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/FTS5Tokenizer.html">FTS5Tokenizer</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/FTS5WrapperTokenizer.html">FTS5WrapperTokenizer</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/MutablePersistable.html">MutablePersistable</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/Persistable.html">Persistable</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/Request.html">Request</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/RowAdapter.html">RowAdapter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/RowConvertible.html">RowConvertible</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/StatementColumnConvertible.html">StatementColumnConvertible</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/TableMapping.html">TableMapping</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/TransactionObserver.html">TransactionObserver</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/TypedRequest.html">TypedRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Protocols/VirtualTableModule.html">VirtualTableModule</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a href="Structs.html">Structures</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Structs.html#/s:4GRDB14AdaptedRequestV">AdaptedRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/AdaptedTypedRequest.html">AdaptedTypedRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/AllColumns.html">AllColumns</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/AnyRequest.html">AnyRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/AnyTypedRequest.html">AnyTypedRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/Column.html">Column</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/ColumnMapping.html">ColumnMapping</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/Configuration.html">Configuration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseDateComponents.html">DatabaseDateComponents</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseDateComponents/Format.html">– Format</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseError.html">DatabaseError</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseEvent.html">DatabaseEvent</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseEvent/Kind.html">– Kind</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseMigrator.html">DatabaseMigrator</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabasePreUpdateEvent.html">DatabasePreUpdateEvent</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabasePreUpdateEvent/Kind.html">– Kind</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseRegion.html">DatabaseRegion</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseValue.html">DatabaseValue</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/DatabaseValue/Storage.html">– Storage</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS3.html">FTS3</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS3Pattern.html">FTS3Pattern</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS3TokenizerDescriptor.html">FTS3TokenizerDescriptor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS4.html">FTS4</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS5.html">FTS5</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS5Pattern.html">FTS5Pattern</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS5TokenFlags.html">FTS5TokenFlags</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS5Tokenization.html">FTS5Tokenization</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FTS5TokenizerDescriptor.html">FTS5TokenizerDescriptor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/FetchedRecordsSectionInfo.html">FetchedRecordsSectionInfo</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/ForeignKeyInfo.html">ForeignKeyInfo</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/IndexInfo.html">IndexInfo</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/PersistenceConflictPolicy.html">PersistenceConflictPolicy</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/PersistenceContainer.html">PersistenceContainer</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/PrimaryKeyInfo.html">PrimaryKeyInfo</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/QueryInterfaceRequest.html">QueryInterfaceRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/RangeRowAdapter.html">RangeRowAdapter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/ResultCode.html">ResultCode</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs.html#/s:4GRDB8RowIndexV">RowIndex</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/SQLCollatedExpression.html">SQLCollatedExpression</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/SQLExpressionLiteral.html">SQLExpressionLiteral</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/SQLFunctionName.html">SQLFunctionName</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/SQLRequest.html">SQLRequest</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/ScopeAdapter.html">ScopeAdapter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/StatementArguments.html">StatementArguments</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Structs/SuffixRowAdapter.html">SuffixRowAdapter</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a href="Typealiases.html">Type Aliases</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Typealiases.html#/s:4GRDB16SQLiteConnectiona">SQLiteConnection</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Typealiases.html#/s:4GRDB15SQLiteStatementa">SQLiteStatement</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Typealiases.html#/s:4GRDB11SQLiteValuea">SQLiteValue</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a href="Typealiases.html#/s:4GRDB13TraceFunctiona">TraceFunction</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a href="Associated Types.html">Associated Types</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a href="Associated Types.html#/s:4GRDB12TypedRequestP10RowDecoder">RowDecoder</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</nav>
|
||
<article class="main-content">
|
||
<section>
|
||
<section class="section">
|
||
<h1>Protocols</h1>
|
||
<p>The following protocols are available globally.</p>
|
||
|
||
</section>
|
||
<section class="section task-group-section">
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB6CursorP"></a>
|
||
<a name="//apple_ref/swift/Protocol/Cursor" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB6CursorP">Cursor</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>A type that supplies the values of some external resource, one at a time.</p>
|
||
<h2 id='overview' class='heading'>Overview</h2>
|
||
|
||
<p>The most common way to iterate over the elements of a cursor is to use a
|
||
<code>while</code> loop:</p>
|
||
<pre class="highlight plaintext"><code>let cursor = ...
|
||
while let element = try cursor.next() {
|
||
...
|
||
}
|
||
</code></pre>
|
||
<h2 id='relationship-with-standard-sequence-and-iteratorprotocol' class='heading'>Relationship with standard Sequence and IteratorProtocol</h2>
|
||
|
||
<p>Cursors share traits with lazy sequences and iterators from the Swift
|
||
standard library. Differences are:</p>
|
||
|
||
<ul>
|
||
<li>Cursor types are classes, and have a lifetime.</li>
|
||
<li>Cursor iteration may throw errors.</li>
|
||
<li>A cursor can not be repeated.</li>
|
||
</ul>
|
||
|
||
<p>The protocol comes with default implementations for many operations similar
|
||
to those defined by Swift’s LazySequenceProtocol:</p>
|
||
|
||
<ul>
|
||
<li><code>func contains(Self.Element)</code></li>
|
||
<li><code>func contains(where: (Self.Element) throws -> Bool)</code></li>
|
||
<li><code>func enumerated()</code></li>
|
||
<li><code>func filter((Self.Element) throws -> Bool)</code></li>
|
||
<li><code>func first(where: (Self.Element) throws -> Bool)</code></li>
|
||
<li><code>func flatMap<ElementOfResult>((Self.Element) throws -> ElementOfResult?)</code></li>
|
||
<li><code>func flatMap<SegmentOfResult>((Self.Element) throws -> SegmentOfResult)</code></li>
|
||
<li><code>func forEach((Self.Element) throws -> Void)</code></li>
|
||
<li><code>func joined()</code></li>
|
||
<li><code>func map<T>((Self.Element) throws -> T)</code></li>
|
||
<li><code>func reduce<Result>(Result, (Result, Self.Element) throws -> Result)</code></li>
|
||
</ul>
|
||
|
||
<a href="Protocols/Cursor.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Cursor</span> <span class="p">:</span> <span class="kd">class</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/Cursor.swift#L62-L69">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB17DatabaseAggregateP"></a>
|
||
<a name="//apple_ref/swift/Protocol/DatabaseAggregate" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB17DatabaseAggregateP">DatabaseAggregate</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for custom SQLite aggregates.</p>
|
||
|
||
<p>For example:</p>
|
||
<pre class="highlight plaintext"><code>struct MySum : DatabaseAggregate {
|
||
var sum: Int = 0
|
||
|
||
mutating func step(_ dbValues: [DatabaseValue]) {
|
||
if let int = Int.fromDatabaseValue(dbValues[0]) {
|
||
sum += int
|
||
}
|
||
}
|
||
|
||
func finalize() -> DatabaseValueConvertible? {
|
||
return sum
|
||
}
|
||
}
|
||
|
||
let dbQueue = DatabaseQueue()
|
||
let fn = DatabaseFunction("mysum", argumentCount: 1, aggregate: MySum.self)
|
||
dbQueue.add(function: fn)
|
||
try dbQueue.inDatabase { db in
|
||
try db.execute("CREATE TABLE test(i)")
|
||
try db.execute("INSERT INTO test(i) VALUES (1)")
|
||
try db.execute("INSERT INTO test(i) VALUES (2)")
|
||
try Int.fetchOne(db, "SELECT mysum(i) FROM test")! // 3
|
||
}
|
||
</code></pre>
|
||
|
||
<a href="Protocols/DatabaseAggregate.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DatabaseAggregate</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/DatabaseFunction.swift#L353-L373">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB14DatabaseReaderP"></a>
|
||
<a name="//apple_ref/swift/Protocol/DatabaseReader" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB14DatabaseReaderP">DatabaseReader</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for all types that can fetch values from a database.</p>
|
||
|
||
<p>It is adopted by DatabaseQueue and DatabasePool.</p>
|
||
|
||
<p>The protocol comes with isolation guarantees that describe the behavior of
|
||
adopting types in a multithreaded application.</p>
|
||
|
||
<p>Types that adopt the protocol can provide in practice stronger guarantees.
|
||
For example, DatabaseQueue provides a stronger isolation level
|
||
than DatabasePool.</p>
|
||
|
||
<p><strong>Warning</strong>: Isolation guarantees stand as long as there is no external
|
||
connection to the database. Should you have to cope with external
|
||
connections, protect yourself with transactions, and be ready to setup a
|
||
<a href="https://www.sqlite.org/c3ref/busy_handler.html">busy handler</a>.</p>
|
||
|
||
<a href="Protocols/DatabaseReader.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DatabaseReader</span> <span class="p">:</span> <span class="kd">class</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/DatabaseReader.swift#L22-L152">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<div class="task-name-container">
|
||
<a name="/DatabaseValueConvertible"></a>
|
||
<a name="//apple_ref/swift/Section/DatabaseValueConvertible" class="dashAnchor"></a>
|
||
<a href="#/DatabaseValueConvertible">
|
||
<h3 class="section-name">DatabaseValueConvertible</h3>
|
||
</a>
|
||
</div>
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB24DatabaseValueConvertibleP"></a>
|
||
<a name="//apple_ref/swift/Protocol/DatabaseValueConvertible" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB24DatabaseValueConvertibleP">DatabaseValueConvertible</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Types that adopt DatabaseValueConvertible can be initialized from
|
||
database values.</p>
|
||
|
||
<p>The protocol comes with built-in methods that allow to fetch cursors,
|
||
arrays, or single values:</p>
|
||
<pre class="highlight plaintext"><code>try String.fetchCursor(db, "SELECT name FROM ...", arguments:...) // Cursor of String
|
||
try String.fetchAll(db, "SELECT name FROM ...", arguments:...) // [String]
|
||
try String.fetchOne(db, "SELECT name FROM ...", arguments:...) // String?
|
||
|
||
let statement = try db.makeSelectStatement("SELECT name FROM ...")
|
||
try String.fetchCursor(statement, arguments:...) // Cursor of String
|
||
try String.fetchAll(statement, arguments:...) // [String]
|
||
try String.fetchOne(statement, arguments:...) // String?
|
||
</code></pre>
|
||
|
||
<p>DatabaseValueConvertible is adopted by Bool, Int, String, etc.</p>
|
||
|
||
<a href="Protocols/DatabaseValueConvertible.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DatabaseValueConvertible</span> <span class="p">:</span> <span class="kt">SQLExpressible</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/DatabaseValueConvertible.swift#L25-L31">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB14DatabaseWriterP"></a>
|
||
<a name="//apple_ref/swift/Protocol/DatabaseWriter" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB14DatabaseWriterP">DatabaseWriter</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for all types that can update a database.</p>
|
||
|
||
<p>It is adopted by DatabaseQueue and DatabasePool.</p>
|
||
|
||
<p>The protocol comes with isolation guarantees that describe the behavior of
|
||
adopting types in a multithreaded application.</p>
|
||
|
||
<p>Types that adopt the protocol can in practice provide stronger guarantees.
|
||
For example, DatabaseQueue provides a stronger isolation level
|
||
than DatabasePool.</p>
|
||
|
||
<p><strong>Warning</strong>: Isolation guarantees stand as long as there is no external
|
||
connection to the database. Should you have to cope with external
|
||
connections, protect yourself with transactions, and be ready to setup a
|
||
<a href="https://www.sqlite.org/c3ref/busy_handler.html">busy handler</a>.</p>
|
||
|
||
<a href="Protocols/DatabaseWriter.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DatabaseWriter</span> <span class="p">:</span> <span class="kt"><a href="Protocols/DatabaseReader.html">DatabaseReader</a></span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/DatabaseWriter.swift#L16-L62">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB12TableMappingP"></a>
|
||
<a name="//apple_ref/swift/Protocol/TableMapping" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB12TableMappingP">TableMapping</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Types that adopt TableMapping declare a particular relationship with
|
||
a database table.</p>
|
||
|
||
<p>Types that adopt both TableMapping and RowConvertible are granted with
|
||
built-in methods that allow to fetch instances identified by key:</p>
|
||
<pre class="highlight plaintext"><code>try Player.fetchOne(db, key: 123) // Player?
|
||
try Citizenship.fetchOne(db, key: ["citizenId": 12, "countryId": 45]) // Citizenship?
|
||
</code></pre>
|
||
|
||
<p>TableMapping is adopted by Record.</p>
|
||
|
||
<a href="Protocols/TableMapping.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">TableMapping</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Record/TableMapping.swift#L11-L50">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/"></a>
|
||
<a name="//apple_ref/swift/Protocol/FTS5CustomTokenizer" class="dashAnchor"></a>
|
||
<a class="token" href="#/">FTS5CustomTokenizer</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for custom FTS5 tokenizers.</p>
|
||
|
||
<a href="Protocols/FTS5CustomTokenizer.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/"></a>
|
||
<a name="//apple_ref/swift/Protocol/FTS5Tokenizer" class="dashAnchor"></a>
|
||
<a class="token" href="#/">FTS5Tokenizer</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for FTS5 tokenizers</p>
|
||
|
||
<a href="Protocols/FTS5Tokenizer.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/"></a>
|
||
<a name="//apple_ref/swift/Protocol/FTS5WrapperTokenizer" class="dashAnchor"></a>
|
||
<a class="token" href="#/">FTS5WrapperTokenizer</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for custom FTS5 tokenizers that wrap another tokenizer.</p>
|
||
|
||
<p>Types that adopt FTS5WrapperTokenizer don’t have to implement the
|
||
low-level FTS5Tokenizer.tokenize(context:flags:pText:nText:tokenCallback:).</p>
|
||
|
||
<p>Instead, they process regular Swift strings.</p>
|
||
|
||
<p>Here is the implementation for a trivial tokenizer that wraps the
|
||
built-in ascii tokenizer without any custom processing:</p>
|
||
<pre class="highlight plaintext"><code>class TrivialAsciiTokenizer : FTS5WrapperTokenizer {
|
||
static let name = "trivial"
|
||
let wrappedTokenizer: FTS5Tokenizer
|
||
|
||
init(db: Database, arguments: [String]) throws {
|
||
wrappedTokenizer = try db.makeTokenizer(.ascii())
|
||
}
|
||
|
||
func accept(token: String, flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) throws {
|
||
try tokenCallback(token, flags)
|
||
}
|
||
}
|
||
</code></pre>
|
||
|
||
<a href="Protocols/FTS5WrapperTokenizer.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<div class="task-name-container">
|
||
<a name="/MutablePersistable"></a>
|
||
<a name="//apple_ref/swift/Section/MutablePersistable" class="dashAnchor"></a>
|
||
<a href="#/MutablePersistable">
|
||
<h3 class="section-name">MutablePersistable</h3>
|
||
</a>
|
||
</div>
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB18MutablePersistableP"></a>
|
||
<a name="//apple_ref/swift/Protocol/MutablePersistable" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB18MutablePersistableP">MutablePersistable</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Types that adopt MutablePersistable can be inserted, updated, and deleted.</p>
|
||
|
||
<a href="Protocols/MutablePersistable.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">MutablePersistable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/TableMapping.html">TableMapping</a></span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Record/Persistable.swift#L172-L314">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<div class="task-name-container">
|
||
<a name="/Persistable"></a>
|
||
<a name="//apple_ref/swift/Section/Persistable" class="dashAnchor"></a>
|
||
<a href="#/Persistable">
|
||
<h3 class="section-name">Persistable</h3>
|
||
</a>
|
||
</div>
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB11PersistableP"></a>
|
||
<a name="//apple_ref/swift/Protocol/Persistable" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB11PersistableP">Persistable</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Types that adopt Persistable can be inserted, updated, and deleted.</p>
|
||
|
||
<p>This protocol is intented for types that don’t have an INTEGER PRIMARY KEY.</p>
|
||
|
||
<p>Unlike MutablePersistable, the insert() and save() methods are not
|
||
mutating methods.</p>
|
||
|
||
<a href="Protocols/Persistable.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Persistable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/MutablePersistable.html">MutablePersistable</a></span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Record/Persistable.swift#L656-L712">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB7RequestP"></a>
|
||
<a name="//apple_ref/swift/Protocol/Request" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB7RequestP">Request</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for all types that define a way to fetch database rows.</p>
|
||
|
||
<p>Requests can feed the fetching methods of any fetchable type (Row,
|
||
value, record):</p>
|
||
<pre class="highlight plaintext"><code>let request: Request = ...
|
||
try Row.fetchCursor(db, request) // RowCursor
|
||
try String.fetchAll(db, request) // [String]
|
||
try Player.fetchOne(db, request) // Player?
|
||
</code></pre>
|
||
|
||
<a href="Protocols/Request.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Request</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/Request.swift#L10-L32">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB12TypedRequestP"></a>
|
||
<a name="//apple_ref/swift/Protocol/TypedRequest" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB12TypedRequestP">TypedRequest</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for requests that know how to decode database rows.</p>
|
||
|
||
<p>Typed requests can fetch if their associated type RowDecoder is able to
|
||
decode rows (Row, value, record)</p>
|
||
<pre class="highlight plaintext"><code>struct Player: RowConvertible { ... }
|
||
let request: ... // Some TypedRequest that fetches Player
|
||
try request.fetchCursor(db) // Cursor of Player
|
||
try request.fetchAll(db) // [Player]
|
||
try request.fetchOne(db) // Player?
|
||
</code></pre>
|
||
|
||
<a href="Protocols/TypedRequest.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">TypedRequest</span> <span class="p">:</span> <span class="kt"><a href="Protocols/Request.html">Request</a></span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/Request.swift#L255-L259">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB10RowAdapterP"></a>
|
||
<a name="//apple_ref/swift/Protocol/RowAdapter" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB10RowAdapterP">RowAdapter</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>RowAdapter is a protocol that helps two incompatible row interfaces working
|
||
together.</p>
|
||
|
||
<p>GRDB ships with four concrete types that adopt the RowAdapter protocol:</p>
|
||
|
||
<ul>
|
||
<li>ColumnMapping: renames row columns</li>
|
||
<li>SuffixRowAdapter: hides the first columns of a row</li>
|
||
<li>RangeRowAdapter: only exposes a range of columns</li>
|
||
<li>ScopeAdapter: groups several adapters together to define named scopes</li>
|
||
</ul>
|
||
|
||
<p>To use a row adapter, provide it to any method that fetches:</p>
|
||
<pre class="highlight plaintext"><code>let adapter = SuffixRowAdapter(fromIndex: 2)
|
||
let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"
|
||
|
||
// <Row baz:3>
|
||
try Row.fetchOne(db, sql, adapter: adapter)
|
||
</code></pre>
|
||
|
||
<a href="Protocols/RowAdapter.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">RowAdapter</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/RowAdapter.swift#L167-L191">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB14RowConvertibleP"></a>
|
||
<a name="//apple_ref/swift/Protocol/RowConvertible" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB14RowConvertibleP">RowConvertible</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Types that adopt RowConvertible can be initialized from a database Row.</p>
|
||
<pre class="highlight plaintext"><code>let row = try Row.fetchOne(db, "SELECT ...")!
|
||
let player = Player(row)
|
||
</code></pre>
|
||
|
||
<p>The protocol comes with built-in methods that allow to fetch cursors,
|
||
arrays, or single records:</p>
|
||
<pre class="highlight plaintext"><code>try Player.fetchCursor(db, "SELECT ...", arguments:...) // Cursor of Player
|
||
try Player.fetchAll(db, "SELECT ...", arguments:...) // [Player]
|
||
try Player.fetchOne(db, "SELECT ...", arguments:...) // Player?
|
||
|
||
let statement = try db.makeSelectStatement("SELECT ...")
|
||
try Player.fetchCursor(statement, arguments:...) // Cursor of Player
|
||
try Player.fetchAll(statement, arguments:...) // [Player]
|
||
try Player.fetchOne(statement, arguments:...) // Player?
|
||
</code></pre>
|
||
|
||
<p>RowConvertible is adopted by Record.</p>
|
||
|
||
<a href="Protocols/RowConvertible.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">RowConvertible</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Record/RowConvertible.swift#L25-L33">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB26StatementColumnConvertibleP"></a>
|
||
<a name="//apple_ref/swift/Protocol/StatementColumnConvertible" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB26StatementColumnConvertibleP">StatementColumnConvertible</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The StatementColumnConvertible protocol grants access to the low-level C
|
||
interface that extracts values from query results:
|
||
<a href="https://www.sqlite.org/c3ref/column_blob.html">https://www.sqlite.org/c3ref/column_blob.html</a>. It can bring performance
|
||
improvements.</p>
|
||
|
||
<p>To use it, have a value type adopt both StatementColumnConvertible and
|
||
DatabaseValueConvertible. GRDB will then automatically apply the
|
||
optimization whenever direct access to SQLite is possible:</p>
|
||
<pre class="highlight plaintext"><code>let rows = Row.fetchCursor(db, "SELECT ...")
|
||
while let row = try rows.next() {
|
||
let int: Int = row[0] // there
|
||
}
|
||
let ints = Int.fetchAll(db, "SELECT ...") // there
|
||
struct Player {
|
||
init(row: Row) {
|
||
name = row["name"] // there
|
||
score = row["score"] // there
|
||
}
|
||
}
|
||
</code></pre>
|
||
|
||
<p>StatementColumnConvertible is already adopted by all Swift integer types,
|
||
Float, Double, String, and Bool.</p>
|
||
|
||
<a href="Protocols/StatementColumnConvertible.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">StatementColumnConvertible</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/StatementColumnConvertible.swift#L30-L51">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<div class="task-name-container">
|
||
<a name="/TransactionObserver"></a>
|
||
<a name="//apple_ref/swift/Section/TransactionObserver" class="dashAnchor"></a>
|
||
<a href="#/TransactionObserver">
|
||
<h3 class="section-name">TransactionObserver</h3>
|
||
</a>
|
||
</div>
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB19TransactionObserverP"></a>
|
||
<a name="//apple_ref/swift/Protocol/TransactionObserver" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB19TransactionObserverP">TransactionObserver</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>A transaction observer is notified of all changes and transactions committed
|
||
or rollbacked on a database.</p>
|
||
|
||
<p>Adopting types must be a class.</p>
|
||
|
||
<a href="Protocols/TransactionObserver.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">TransactionObserver</span> <span class="p">:</span> <span class="kd">class</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/Core/TransactionObserver.swift#L644-L722">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<ul>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:4GRDB18VirtualTableModuleP"></a>
|
||
<a name="//apple_ref/swift/Protocol/VirtualTableModule" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:4GRDB18VirtualTableModuleP">VirtualTableModule</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The protocol for SQLite virtual table modules. It lets you define a DSL for
|
||
the <code>Database.create(virtualTable:using:)</code> method:</p>
|
||
<pre class="highlight plaintext"><code>let module = ...
|
||
try db.create(virtualTable: "items", using: module) { t in
|
||
...
|
||
}
|
||
</code></pre>
|
||
|
||
<p>GRDB ships with three concrete classes that implement this protocol: FTS3,
|
||
FTS4 and FTS5.</p>
|
||
|
||
<a href="Protocols/VirtualTableModule.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">VirtualTableModule</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/groue/GRDB.swift/tree/v2.7.0/GRDB/QueryInterface/VirtualTableModule.swift#L11-L38">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<section id="footer">
|
||
<p>© 2018 <a class="link" href="https://github.com/groue" target="_blank" rel="external">Gwendal Roué</a>. All rights reserved. (Last updated: 2018-01-21)</p>
|
||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||
</section>
|
||
</article>
|
||
</div>
|
||
</body>
|
||
</div>
|
||
</html>
|