UNPKG

3.08 kBTypeScriptView Raw
1/// <reference path="model.d.ts" />
2/// <reference path="instance.d.ts" />
3
4declare namespace FxOrmSynchronous {
5 interface VoidReturn {
6 (): void
7 }
8 interface UnknownReturn {
9 (): any
10 }
11
12 interface SynchronizedModel {
13 findSync: {
14 (conditions?: FxOrmModel.ModelQueryConditions__Find, options?: FxOrmModel.ModelOptions__Find): FxOrmInstance.Instance[]
15 (conditions: FxOrmModel.ModelQueryConditions__Find, limit: number, order: string[]): FxOrmInstance.Instance[]
16 }
17 allSync: SynchronizedModel['findSync']
18 whereSync: SynchronizedModel['findSync']
19
20 countSync: {
21 (conditions?: FxOrmModel.ModelQueryConditions__Find): number;
22 }
23 existsSync: {
24 (...conditions: (FibOrmNS.IdType | FxSqlQuerySubQuery.SubQueryConditions)[]): boolean
25 }
26 oneSync: {
27 (conditions?: FxOrmModel.ModelQueryConditions__Find, options?: FxOrmModel.ModelOptions__Find): FxOrmInstance.Instance
28 (conditions?: FxOrmModel.ModelQueryConditions__Find, order?: string[]): FxOrmInstance.Instance
29 }
30
31 createSync: {
32 (data: FxOrmInstance.InstanceDataPayload): FxOrmInstance.Instance;
33 (data: FxOrmInstance.InstanceDataPayload[]): FxOrmInstance.Instance[];
34 }
35 getSync: {
36 (...ids: any[]): FxOrmInstance.Instance; // this Instance is from its callback
37 }
38 findBySync: {
39 <T = any>(
40 ext_name: string,
41 conditions?: FxOrmModel.ModelQueryConditions__Find,
42 options?: FxOrmAssociation.ModelAssociationMethod__FindByOptions,
43 ): FxOrmInstance.Instance[]
44 }
45
46 // it's callback version could return `this: ORM`
47 syncSync: VoidReturn
48 clearSync: VoidReturn
49 dropSync: UnknownReturn
50
51 /**
52 * other patched synchronous version method
53 * - lazyLoad: getXXXSync, setXXXSync, removeXXXSync
54 * - association: [addAccessor]Sync, [getAccessor]Sync, [hasAccessor]Sync, [setAccessor]Sync, [removeAccessor]Sync
55 */
56 [ek: string]: any
57 }
58
59 interface SynchronizedInstance {
60 saveSync: {
61 (data?: FxOrmInstance.InstanceDataPayload, options?: FxOrmInstance.SaveOptions): FxOrmInstance.Instance
62 }
63 removeSync: {
64 (): void
65 }
66 validateSync: {
67 (): false | FxOrmError.ExtendedError[]
68 }
69 /**
70 * other patched synchronous version method
71 * - lazyLoad: getXXXSync, setXXXSync, removeXXXSync
72 * - association: [addAccessor]Sync, [getAccessor]Sync, [hasAccessor]Sync, [setAccessor]Sync, [removeAccessor]Sync
73 */
74 [ek: string]: any
75 }
76
77 // TODO: to implement it.
78 interface SynchronizedIChainFind {
79
80 }
81
82 interface SynchronizedORMInstance {
83 // it's callback version could return `this: ORM`
84 syncSync: VoidReturn
85 closeSync: VoidReturn
86 dropSync: VoidReturn
87 pingSync: VoidReturn
88 }
89}
\No newline at end of file