✨ Add optimistic concurrency control and atomic file operations
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* FileService 提供原子化文件操作
|
||||
* FileService 提供文件操作
|
||||
* @module
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
// @ts-ignore: Unused imports
|
||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as time$0 from "../../../time/models.js";
|
||||
|
||||
/**
|
||||
* DeleteFile 删除文件
|
||||
*/
|
||||
@@ -34,6 +38,14 @@ export function FileExists(filePath: string): Promise<boolean> & { cancel(): voi
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetFileModTime 获取文件的修改时间
|
||||
*/
|
||||
export function GetFileModTime(filePath: string): Promise<time$0.Time> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2240854203, filePath) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* LoadJSON 从文件加载JSON数据
|
||||
*/
|
||||
@@ -43,9 +55,19 @@ export function LoadJSON(filePath: string, target: any): Promise<void> & { cance
|
||||
}
|
||||
|
||||
/**
|
||||
* SaveJSON 原子化保存JSON数据到文件
|
||||
* SaveJSON 保存JSON数据到文件
|
||||
*/
|
||||
export function SaveJSON(filePath: string, data: any): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3646933935, filePath, data) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* SaveJSONWithCheck 保存JSON数据到文件,带并发检查
|
||||
* expectedModTime是期望的文件修改时间,如果为零值则不检查
|
||||
* onConflict是冲突处理函数,如果文件已被修改且此函数不为nil,则调用此函数合并数据
|
||||
*/
|
||||
export function SaveJSONWithCheck(filePath: string, data: any, expectedModTime: time$0.Time, onConflict: any): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(4074237977, filePath, data, expectedModTime, onConflict) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
Reference in New Issue
Block a user