rename: kv db

This commit is contained in:
clz 2024-09-15 18:14:55 +08:00
parent 407ecdeb73
commit b9cd46db5e
2 changed files with 36 additions and 4 deletions

View File

@ -0,0 +1,36 @@
/**
* Created on 2024/9/15
*/
package ohos_app_cangjie_entry.support.support_database
import ohos.distributed_kv_store.*
import ohos.ability.*
public class KVStore {
private static let appId: String = 'himi'
private let storeId: String = 'KVStore'
private let context: AbilityContext
private let kvStore: SingleKVStore
public init(context: AbilityContext, storeId: String) {
this.context = context
this.kvStore = createKVStore(
context: context,
storeId: storeId,
)
}
private static func createKVStore(context!: AbilityContext, storeId!: String) {
let kvMangerConfig = KVManagerConfig(getStageContext(context), appId)
let kvManger = DistributedKVStore.createKVManager(kvMangerConfig)
kvManger.getSingleKVStore(
storeId,
Options(
SecurityLevel.S2,
autoSync: true,
),
)
}
public func getValue() {}
public func setValue() {}
}

View File

@ -1,4 +0,0 @@
/**
* Created on 2024/9/15
*/
package ohos_app_cangjie_entry.support.support_database