-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native set load measured #8242
Native set load measured #8242
Changes from 3 commits
c15d9fc
43e44e5
702b9dd
6ab84f0
6e3bbdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,9 @@ import SQLite | |
extension Database { | ||
public func queryCategoryId(inTeamId teamId: String, type: String, forServerUrl serverUrl: String) -> String? { | ||
if let db = try? getDatabaseForServer(serverUrl) { | ||
let idCol = Expression<String>("id") | ||
let teamIdCol = Expression<String>("team_id") | ||
let typeCol = Expression<String>("type") | ||
let idCol = SQLite.Expression<String>("id") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Updated: since I read previous comment that the problem is due to Xcode 16. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I admit, when I saw 23 files changed, I made a note to myself that I need to carve a bit more time to run through this PR. |
||
let teamIdCol = SQLite.Expression<String>("team_id") | ||
let typeCol = SQLite.Expression<String>("type") | ||
let query = categoryTable.where(teamIdCol == teamId && typeCol == type) | ||
if let result = try? db.pluck(query) { | ||
return try? result.get(idCol) | ||
|
@@ -18,9 +18,9 @@ extension Database { | |
|
||
public func queryCategoryChannelId(inCategoryId categoryId: String, channelId: String, forServerUrl serverUrl: String) -> String? { | ||
if let db = try? getDatabaseForServer(serverUrl) { | ||
let idCol = Expression<String>("id") | ||
let categoryIdCol = Expression<String>("category_id") | ||
let channelIdCol = Expression<String>("channel_id") | ||
let idCol = SQLite.Expression<String>("id") | ||
let categoryIdCol = SQLite.Expression<String>("category_id") | ||
let channelIdCol = SQLite.Expression<String>("channel_id") | ||
let query = categoryChannelTable.where(categoryIdCol == categoryId && channelIdCol == channelId) | ||
if let result = try? db.pluck(query) { | ||
return try? result.get(idCol) | ||
|
@@ -38,7 +38,7 @@ extension Database { | |
} | ||
|
||
public func insertChannelToDefaultCategory(_ db: Connection, _ categoryChannels: [CategoryChannel]) throws { | ||
let categoryId = Expression<String>("category_id") | ||
let categoryId = SQLite.Expression<String>("category_id") | ||
for cc in categoryChannels { | ||
let count = (try? db.scalar(categoryChannelTable.where(categoryId == cc.categoryId).count)) ?? 0 | ||
let setter = createCategoryChannelsSetter(from: cc, index: count > 0 ? count + 1 : 0) | ||
|
@@ -47,14 +47,14 @@ extension Database { | |
} | ||
|
||
private func createCategoriesSetter(from categories: [Category]) -> [[Setter]] { | ||
let id = Expression<String>("id") | ||
let collapsed = Expression<Bool>("collapsed") | ||
let displayName = Expression<String>("display_name") | ||
let muted = Expression<Bool>("muted") | ||
let sortOrder = Expression<Int>("sort_order") | ||
let sorting = Expression<String>("sorting") | ||
let teamId = Expression<String>("team_id") | ||
let type = Expression<String>("type") | ||
let id = SQLite.Expression<String>("id") | ||
let collapsed = SQLite.Expression<Bool>("collapsed") | ||
let displayName = SQLite.Expression<String>("display_name") | ||
let muted = SQLite.Expression<Bool>("muted") | ||
let sortOrder = SQLite.Expression<Int>("sort_order") | ||
let sorting = SQLite.Expression<String>("sorting") | ||
let teamId = SQLite.Expression<String>("team_id") | ||
let type = SQLite.Expression<String>("type") | ||
|
||
var setters = [[Setter]]() | ||
for category in categories { | ||
|
@@ -74,10 +74,10 @@ extension Database { | |
} | ||
|
||
private func createCategoryChannelsSetter(from categories: [Category]) -> [[Setter]] { | ||
let id = Expression<String>("id") | ||
let categoryId = Expression<String>("category_id") | ||
let channelId = Expression<String>("channel_id") | ||
let sortOrder = Expression<Int>("sort_order") | ||
let id = SQLite.Expression<String>("id") | ||
let categoryId = SQLite.Expression<String>("category_id") | ||
let channelId = SQLite.Expression<String>("channel_id") | ||
let sortOrder = SQLite.Expression<Int>("sort_order") | ||
|
||
var setters = [[Setter]]() | ||
for category in categories { | ||
|
@@ -95,10 +95,10 @@ extension Database { | |
} | ||
|
||
private func createCategoryChannelsSetter(from categoryChannel: CategoryChannel, index: Int = 0) -> [Setter] { | ||
let id = Expression<String>("id") | ||
let categoryId = Expression<String>("category_id") | ||
let channelId = Expression<String>("channel_id") | ||
let sortOrder = Expression<Int>("sort_order") | ||
let id = SQLite.Expression<String>("id") | ||
let categoryId = SQLite.Expression<String>("category_id") | ||
let channelId = SQLite.Expression<String>("channel_id") | ||
let sortOrder = SQLite.Expression<Int>("sort_order") | ||
|
||
var setter = [Setter]() | ||
setter.append(id <- categoryChannel.id) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this package are because of changes in iOS 18.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a better solution for this.. I'll share when I can.
Btw this is cause Xcode 16 not ios 18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The better way to fix this issue is by adding this line
typealias Expression = SQLite.Expression
after the imports in theStorage/Database.swift
file, all other changes to the Gekidou library would not be needed.