Package storage.kv
class JsonKVStorage
func close
public func close(): Unit
prop collection
public prop collection: String
func commit
public func commit(): Unit
func get
public func get(id: String): Option<T>
func init
public init(workspace!: String = ".storage", collection!: String = "default")
- 描述: 初始化JsonKVStorage实例
- 参数:
workspace: String, 存储的工作目录,默认为".storage"
collection: String, 存储的集合名称,默认为"default"
func insertInc
public func insertInc(value: T): String
func remove
public func remove(id: String): Option<T>
func reset
public func reset(): Unit
func upsert
public func upsert(id: String, value: T): Unit
- 描述: 更新或插入值
- 参数:
id: String, 要更新或插入的值的ID
value: T, 要更新或插入的值
prop workspace
public prop workspace: String
interface KVStorage
func get
func get(id: String): Option<T>
func remove
func remove(id: String): Option<T>
func upsert
func upsert(id: String, value: T): Unit
- 描述: 插入或更新存储的值
- 参数:
id: String, 要插入或更新的值的唯一标识符
value: T, 要存储的值
interface LocalKVStorage