Interface StoreHandle

数据表的操作方法

interface StoreHandle {
    batchCreate: (<T>(data) => Promise<T[]>);
    batchDelete: (<T>(ids) => Promise<Record<T, boolean>>);
    batchUpdate: (<T>(data) => Promise<T[]>);
    create: ((data) => Promise<boolean>);
    delete: ((id) => Promise<boolean>);
    deleteAll: (() => Promise<boolean>);
    getAll: (() => Promise<StoreAllValue<any>>);
    getId: ((id) => Promise<any>);
    getIds: ((ids) => Promise<any[]>);
    getPage: ((query) => Promise<PagingValue<any>>);
    onChange: (<T>(callback) => {
        callback: T;
        id: string;
        remove: (() => void);
    });
    update: ((data) => Promise<boolean>);
}

Hierarchy

  • CommonHandle
    • StoreHandle

Properties

batchCreate: (<T>(data) => Promise<T[]>)

批量添加数据

Type declaration

    • <T>(data): Promise<T[]>
    • Type Parameters

      • T

      Parameters

      • data: T[]

      Returns Promise<T[]>

batchDelete: (<T>(ids) => Promise<Record<T, boolean>>)

批量删除数据

Type declaration

    • <T>(ids): Promise<Record<T, boolean>>
    • Type Parameters

      • T extends string

      Parameters

      • ids: T[]

      Returns Promise<Record<T, boolean>>

batchUpdate: (<T>(data) => Promise<T[]>)

批量更新数据

Type declaration

    • <T>(data): Promise<T[]>
    • Type Parameters

      Parameters

      • data: T[]

      Returns Promise<T[]>

create: ((data) => Promise<boolean>)

添加数据

Type declaration

    • (data): Promise<boolean>
    • Parameters

      • data: any

      Returns Promise<boolean>

delete: ((id) => Promise<boolean>)

删除数据

Type declaration

    • (id): Promise<boolean>
    • Parameters

      • id: string

      Returns Promise<boolean>

deleteAll: (() => Promise<boolean>)

删除所有数据

Type declaration

    • (): Promise<boolean>
    • Returns Promise<boolean>

getAll: (() => Promise<StoreAllValue<any>>)

获取查询条件的所有数据

Type declaration

getId: ((id) => Promise<any>)

获取单条数据详情

Type declaration

    • (id): Promise<any>
    • Parameters

      • id: string

      Returns Promise<any>

getIds: ((ids) => Promise<any[]>)

获取多条数据详情

Type declaration

    • (ids): Promise<any[]>
    • Parameters

      • ids: string[]

      Returns Promise<any[]>

getPage: ((query) => Promise<PagingValue<any>>)

获取查询条件的分页数据

Type declaration

onChange: (<T>(callback) => {
    callback: T;
    id: string;
    remove: (() => void);
})

监听数据发生变化

Type declaration

    • <T>(callback): {
          callback: T;
          id: string;
          remove: (() => void);
      }
    • Type Parameters

      • T extends ((changeData) => void)

      Parameters

      • callback: T

      Returns {
          callback: T;
          id: string;
          remove: (() => void);
      }

      • callback: T
      • id: string
      • remove: (() => void)
          • (): void
          • Returns void

update: ((data) => Promise<boolean>)

更新数据

Type declaration

    • (data): Promise<boolean>
    • Parameters

      Returns Promise<boolean>