mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-22 19:54:45 +02:00
Convert objects to realm-native
This commit is contained in:
parent
a3e458fcc4
commit
a9d7fbc083
12 changed files with 896 additions and 496 deletions
|
@ -7,33 +7,20 @@
|
|||
|
||||
import Foundation
|
||||
import RealmSwift
|
||||
import Unrealm
|
||||
|
||||
struct ServerConnectionConfig: Realmable {
|
||||
var id: String = UUID().uuidString
|
||||
var index: Int = 1
|
||||
var name: String = ""
|
||||
var address: String = ""
|
||||
var userId: String = ""
|
||||
var username: String = ""
|
||||
var token: String = ""
|
||||
|
||||
static func primaryKey() -> String? {
|
||||
return "id"
|
||||
}
|
||||
|
||||
static func indexedProperties() -> [String] {
|
||||
return ["index"]
|
||||
}
|
||||
class ServerConnectionConfig: Object {
|
||||
@Persisted(primaryKey: true) var id: String = UUID().uuidString
|
||||
@Persisted(indexed: true) var index: Int = 1
|
||||
@Persisted var name: String = ""
|
||||
@Persisted var address: String = ""
|
||||
@Persisted var userId: String = ""
|
||||
@Persisted var username: String = ""
|
||||
@Persisted var token: String = ""
|
||||
}
|
||||
|
||||
struct ServerConnectionConfigActiveIndex: Realmable {
|
||||
class ServerConnectionConfigActiveIndex: Object {
|
||||
// This could overflow, but you really would have to try
|
||||
var index: Int?
|
||||
|
||||
static func primaryKey() -> String? {
|
||||
return "index"
|
||||
}
|
||||
@Persisted(primaryKey: true) var index: Int?
|
||||
}
|
||||
|
||||
func convertServerConnectionConfigToJSON(config: ServerConnectionConfig) -> Dictionary<String, Any> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue