Refactor entire codebase and rewrite documentation
This commit is contained in:
@@ -2,10 +2,10 @@ import Foundation
|
||||
|
||||
/// A type representing SQLite pragmas.
|
||||
///
|
||||
/// The `Pragma` structure provides a convenient way to work with
|
||||
/// SQLite pragmas, which are special commands used to control various aspects
|
||||
/// of the SQLite database engine. For more information on SQLite pragmas,
|
||||
/// visit the [SQLite Pragma Documentation](https://www.sqlite.org/pragma.html).
|
||||
/// The `Pragma` structure provides a convenient way to work with SQLite pragmas, which are special
|
||||
/// commands used to control various aspects of the SQLite database engine.
|
||||
///
|
||||
/// - SeeAlso: [SQLite Pragma Documentation](https://sqlite.org/pragma.html).
|
||||
///
|
||||
/// ## Topics
|
||||
///
|
||||
@@ -26,8 +26,8 @@ public struct Pragma: RawRepresentable, CustomStringConvertible, ExpressibleBySt
|
||||
|
||||
/// The raw string value of the pragma.
|
||||
///
|
||||
/// This is the underlying string that represents the pragma, which can be used
|
||||
/// directly in SQL queries.
|
||||
/// This is the underlying string that represents the pragma, which can be used directly in SQL
|
||||
/// queries.
|
||||
public var rawValue: String
|
||||
|
||||
/// A textual representation of the pragma.
|
||||
@@ -41,64 +41,75 @@ public struct Pragma: RawRepresentable, CustomStringConvertible, ExpressibleBySt
|
||||
|
||||
/// Represents the `application_id` pragma.
|
||||
///
|
||||
/// This pragma allows you to query or set the application ID associated with the
|
||||
/// SQLite database file. The application ID is a 32-bit integer that can be used for
|
||||
/// versioning or identification purposes. For more details, see
|
||||
/// [application_id](https://www.sqlite.org/pragma.html#pragma_application_id).
|
||||
/// This pragma allows you to query or set the application ID associated with the SQLite
|
||||
/// database file. The application ID is a 32-bit integer that can be used for versioning or
|
||||
/// identification purposes.
|
||||
///
|
||||
/// - SeeAlso: [application_id](https://sqlite.org/pragma.html#pragma_application_id).
|
||||
public static let applicationID: Pragma = "application_id"
|
||||
|
||||
/// Represents the `foreign_keys` pragma.
|
||||
///
|
||||
/// This pragma controls the enforcement of foreign key constraints in SQLite.
|
||||
/// Foreign key constraints are disabled by default, but you can enable them
|
||||
/// by using this pragma. For more details, see
|
||||
/// [foreign_keys](https://www.sqlite.org/pragma.html#pragma_foreign_keys).
|
||||
/// This pragma controls the enforcement of foreign key constraints in SQLite. Foreign key
|
||||
/// constraints are disabled by default, but you can enable them by using this pragma.
|
||||
///
|
||||
/// - SeeAlso: [foreign_keys](https://sqlite.org/pragma.html#pragma_foreign_keys).
|
||||
public static let foreignKeys: Pragma = "foreign_keys"
|
||||
|
||||
/// Represents the `journal_mode` pragma.
|
||||
///
|
||||
/// This pragma is used to query or configure the journal mode for the database connection.
|
||||
/// The journal mode determines how transactions are logged, influencing both the
|
||||
/// performance and recovery behavior of the database. For more details, see
|
||||
/// [journal_mode](https://www.sqlite.org/pragma.html#pragma_journal_mode).
|
||||
/// This pragma is used to query or configure the journal mode for the database connection. The
|
||||
/// journal mode determines how transactions are logged, influencing both the performance and
|
||||
/// recovery behavior of the database.
|
||||
///
|
||||
/// - SeeAlso: [journal_mode](https://sqlite.org/pragma.html#pragma_journal_mode).
|
||||
public static let journalMode: Pragma = "journal_mode"
|
||||
|
||||
/// Represents the `synchronous` pragma.
|
||||
///
|
||||
/// This pragma is used to query or configure the synchronous mode for the database connection.
|
||||
/// The synchronous mode controls how the database synchronizes with the disk during write operations,
|
||||
/// affecting both performance and durability. For more details, see
|
||||
/// [synchronous](https://www.sqlite.org/pragma.html#pragma_synchronous).
|
||||
/// The synchronous mode controls how the database synchronizes with the disk during write
|
||||
/// operations, affecting both performance and durability.
|
||||
///
|
||||
/// - SeeAlso: [synchronous](https://sqlite.org/pragma.html#pragma_synchronous).
|
||||
public static let synchronous: Pragma = "synchronous"
|
||||
|
||||
/// Represents the `user_version` pragma.
|
||||
///
|
||||
/// This pragma is commonly used to query or set the user version number associated
|
||||
/// with the database file. It is useful for schema versioning or implementing custom
|
||||
/// database management strategies. For more details, see
|
||||
/// [user_version](https://www.sqlite.org/pragma.html#pragma_user_version).
|
||||
/// This pragma is commonly used to query or set the user version number associated with the
|
||||
/// database file. It is useful for schema versioning or implementing custom database management
|
||||
/// strategies.
|
||||
///
|
||||
/// - SeeAlso: [user_version](https://sqlite.org/pragma.html#pragma_user_version).
|
||||
public static let userVersion: Pragma = "user_version"
|
||||
|
||||
/// Represents the `busy_timeout` pragma.
|
||||
///
|
||||
/// This pragma defines the number of milliseconds that SQLite will wait for a locked database
|
||||
/// before returning a `SQLITE_BUSY` error. It helps prevent failures when multiple connections
|
||||
/// attempt to write simultaneously.
|
||||
///
|
||||
/// - SeeAlso: [busy_timeout](https://sqlite.org/pragma.html#pragma_busy_timeout).
|
||||
public static let busyTimeout: Pragma = "busy_timeout"
|
||||
|
||||
// MARK: - Inits
|
||||
|
||||
/// Initializes a `Pragma` instance with the provided raw value.
|
||||
///
|
||||
/// - Parameter rawValue: The raw string value of the pragma.
|
||||
/// This initializer allows you to create a `Pragma` instance with any raw string that
|
||||
/// represents a valid SQLite pragma.
|
||||
///
|
||||
/// This initializer allows you to create a `Pragma` instance with any raw string
|
||||
/// that represents a valid SQLite pragma.
|
||||
/// - Parameter rawValue: The raw string value of the pragma.
|
||||
public init(rawValue: String) {
|
||||
self.rawValue = rawValue
|
||||
}
|
||||
|
||||
/// Initializes a `Pragma` instance with the provided string literal.
|
||||
///
|
||||
/// - Parameter value: The string literal representing the pragma.
|
||||
/// This initializer allows you to create a `Pragma` instance using a string literal, providing
|
||||
/// a convenient syntax for common pragmas.
|
||||
///
|
||||
/// This initializer allows you to create a `Pragma` instance using a string literal,
|
||||
/// providing a convenient syntax for common pragmas.
|
||||
/// - Parameter value: The string literal representing the pragma.
|
||||
public init(stringLiteral value: String) {
|
||||
self.rawValue = value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user