-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// Sqlite3.swift | ||
// Cryato | ||
// | ||
// Created by John Melody Me on 18/02/2023. | ||
// | ||
|
||
import Foundation | ||
|
||
#if canImport(SQLite) | ||
import SQLite | ||
#endif | ||
|
||
class DatabaseManager { | ||
private var FILE_NAME :String = "Records.sqlite3" | ||
private var database :Connection! | ||
private var RECORDS :Table! | ||
private var id :Expression<Int64>! | ||
private var dateTime :Expression<String>! | ||
private var unitPurchased :Expression<Int64>! | ||
private var originalPrice :Expression<Double>! | ||
private var sellingPrice :Expression<Double>! | ||
|
||
public init() { | ||
do { | ||
let path :String = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? "" | ||
|
||
self.database = try Connection("\(path)/\(self.FILE_NAME)") | ||
self.RECORDS = Table("Records") | ||
|
||
self.id = Expression<Int64>("id") | ||
self.dateTime = Expression<String>("dateTime") | ||
|
||
} catch { | ||
NSLog(error.localizedDescription) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// DBTransactionsRecords.swift | ||
// Cryato | ||
// | ||
// Created by John Melody Me on 18/02/2023. | ||
// | ||
|
||
import Foundation | ||
|
||
struct DBTransRecords : Identifiable { | ||
public var id :Int64 = 0 | ||
public var dateTime :String = "" | ||
public var unitPurchased :Int64 = 0 | ||
public var originalPrice :Double = 0.0 | ||
public var sellingPrice :Double = 0.0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters