Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AGCCloudDBService

Hierarchy

Index

Methods

closeCloudDBZone

  • en

    Developers can invoke this method to close a Cloud DB zone object opened on the device. Before using this method to close a Cloud DB zone, ensure that the data insertion, deletion, query, and snapshot listening operations based on the Cloud DB zone have been completed. After using Cloud DB zone to add, delete, modify, or query data, you can determine whether to close the Cloud DB zone to release resources occupied by Cloud DB zone. Closing Cloud DB zone does not delete underlying data files. If you attempt to close an inexistent Cloud DB zone or repeatedly close Cloud DB zone, the system returns a success message and does not report any exception.

    zh

    开发者调用此方法关闭端侧打开的 Cloud DB zone 对象。 使用本方法关闭某个 Cloud DB zone 前,需要确保当前基于该 Cloud DB zone 的数据的插入、删除、查询和快照侦听操作已完成,否则会无法关闭。 开发者在使用一个 Cloud DB zone 进行数据增、删、改、查操作之后,可以根据需要选择是否暂时关闭该 Cloud DB zone,从而释放该 Cloud DB zone 占有的资源。关闭 Cloud DB zone 不删除底层的数据文件。关闭某个不存在的 Cloud DB zone,或者重复关闭时,系统均返回成功,不会抛出异常。

    Parameters

    Returns void

deleteCloudDBZone

  • deleteCloudDBZone(zoneId: string): void
  • en

    Developers can invoke this method to delete a Cloud DB zone object that is no longer used on the device. You can delete Cloud DB zone only after Cloud DB zone is closed. If you do not need to use Cloud DB zone and its data, you can invoke this method to delete Cloud DB zone. After Cloud DB zone is deleted, the data files stored on the disk are deleted when the memory resources are released. If you attempt to repeatedly delete Cloud DB zone or delete an inexistent Cloud DB zone, the system returns a success message and no exception will occur.

    zh

    开发者调用此方法删除端侧不再使用的 Cloud DB zone 对象。仅在关闭 Cloud DB zone 之后,才能执行删除 Cloud DB zone 的操作。 当开发者无需继续使用某个 Cloud DB zone 和其内的数据时,可以调用本方法彻底删除该 Cloud DB zone。开发者删除该 Cloud DB zone后,在释放内存资源的同时,还会同时删除其在磁盘上存储的数据文件。重复删除或者删除不存在的 Cloud DB zone,均返回成功,不抛异常。

    Parameters

    • zoneId: string

      Cloud DB zone name. same zome id.

    Returns void

getCloudDBZoneConfigs

  • en

    Developers can invoke this method to obtain all AGCCloudDBZoneConfig lists in the AGConnectCloudDB instance on the device.

    zh

    开发者调用此方法获取端侧 AGConnectCloudDB 实例中的全部 AGCCloudDBZoneConfig 列表。

    Returns AGCCloudDBZoneConfig[]

    A AGCCloudDBZoneConfig object list. For details about the objects

off

  • off(event_name: string, cb: (data: any) => void, node: any): void
  • en

    remove event listener

    zh

    取消事件的监听

    Parameters

    • event_name: string

      event name

    • cb: (data: any) => void

      callback function

        • (data: any): void
        • Parameters

          • data: any

          Returns void

    • node: any

      target node

    Returns void

on

  • on(event: "db", cb: (data: { type: "open-zone-success"; zone: AGCCloudDBZone }) => void, node?: any): void
  • on(event: "error", cb: (data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • on(event: "insert", cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • on(event: "delete", cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • on(event: "query", cb: (data: { queryId: string; result: AGCCloudDBObject[]; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • on(event: "queryAverage", cb: (data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • on(event: "subscribe", cb: (data: { queryId: string; result: AGCCloudDBObject[]; subscribeId: string; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • en

    event listener

    zh

    持续监听事件

    Parameters

    • event: "db"

      event name

    • cb: (data: { type: "open-zone-success"; zone: AGCCloudDBZone }) => void

      event callback

    • Optional node: any

      target node

    Returns void

  • Parameters

    • event: "error"
    • cb: (data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          • data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }
            • errCode: number
            • errMsg: string
            • typeName: string
            • zone: AGCCloudDBZone

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    • event: "insert"
    • cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { count: number; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    • event: "delete"
    • cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { count: number; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    Returns void

  • Parameters

    • event: "queryAverage"
    • cb: (data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          • data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }
            • average: number
            • field: string
            • queryId: string
            • typeName: string
            • zone: AGCCloudDBZone

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    Returns void

once

  • once(event: "db", cb: (data: { type: "open-zone-success"; zone: AGCCloudDBZone }) => void, node?: any): void
  • once(event: "error", cb: (data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • once(event: "insert", cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • once(event: "delete", cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • once(event: "query", cb: (data: { queryId: string; result: AGCCloudDBObject[]; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • once(event: "queryAverage", cb: (data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • once(event: "subscribe", cb: (data: { queryId: string; result: AGCCloudDBObject[]; subscribeId: string; typeName: string; zone: AGCCloudDBZone }) => void, node?: any): void
  • en

    event listener for once

    zh

    监听一次事件

    Parameters

    • event: "db"

      event name

    • cb: (data: { type: "open-zone-success"; zone: AGCCloudDBZone }) => void

      event callback

    • Optional node: any

      target node

    Returns void

  • Parameters

    • event: "error"
    • cb: (data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          • data: { errCode: number; errMsg: string; typeName: string; zone: AGCCloudDBZone }
            • errCode: number
            • errMsg: string
            • typeName: string
            • zone: AGCCloudDBZone

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    • event: "insert"
    • cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { count: number; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    • event: "delete"
    • cb: (data: { count: number; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { count: number; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    Returns void

  • Parameters

    • event: "queryAverage"
    • cb: (data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }) => void
        • (data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }): void
        • Parameters

          • data: { average: number; field: string; queryId: string; typeName: string; zone: AGCCloudDBZone }
            • average: number
            • field: string
            • queryId: string
            • typeName: string
            • zone: AGCCloudDBZone

          Returns void

    • Optional node: any

    Returns void

  • Parameters

    Returns void

openCloudDBZone

  • en

    Developers can invoke this API to create or open an object of a Cloud DB zone on the device. An object of a Cloud DB zone represents a unique data storage zone. An application supports a maximum of 10 Cloud DB zone objects on the device. Developers can open a Cloud DB zone for multiple times, but need to close the Cloud DB zone after the operation is complete. That is, opening a Cloud DB zone must be followed by a closing operation. Otherwise, an exception may be thrown during deletion. When you use the AGCCloudDBZoneConfig object to open an existing Cloud DB zone, ensure that the properties specified in AGCCloudDBZoneConfig are the same as those of the existing Cloud DB zone. If they are different, the system throws an exception.

    zh

    开发者调用此方法在端侧创建或者打开一个 Cloud DB zone 对象,一个 Cloud DB zone 对象表示一个唯一的数据存储区域。一个应用在端侧最多支持创建 10 个 Cloud DB zone。 开发者可以多次打开某个 Cloud DB zone,但每次使用完 Cloud DB zone 后,都需要关闭该 Cloud DB zone,即每个打开操作需要一个对应的关闭操作,否则,可能会在删除 Cloud DB zone 时,抛出异常。 当使用 AGCCloudDBZoneConfig 对象打开一个已有的 Cloud DB zone 时,需要保证 AGCCloudDBZoneConfig 中指定的属性与已有 Cloud DB zone 的属性一致,如果不一致,系统会抛出异常。

    Parameters

    • config: AGCCloudDBZoneConfig

      AGCCloudDBZoneConfig object, which is used to create or open a configuration file of Cloud DB zone.

    • isAllowToCreate: boolean

      Specifies whether to allow Cloud DB zone object creation.

    Returns AGCCloudDBZone

    AGCCloudDBZone object. Developers can use this object to add, delete, modify, query, and listen on data.

openCloudDBZone2

  • en

    This method is called to asynchronously create or open a Cloud DB zone object on the device. A Cloud DB zone object represents a unique data storage zone. An application supports a maximum of 4 Cloud DB zone on the device. Developers can open a Cloud DB zone for multiple times, but need to close the Cloud DB zone after the operation is complete. That is, opening a Cloud DB zone must be followed by a closing operation. Otherwise, an exception is thrown during deletion. When you use the CloudDBZoneConfig object to open an existing Cloud DB zone, ensure that the properties specified in CloudDBZoneConfig are the same as those of the existing Cloud DB zone. If they are different, the system throws an exception.

    zh

    开发者调用此方法在端侧异步创建或者打开一个 Cloud DB zone对象,一个 Cloud DB zone对象表示一个唯一的数据存储区域。一个应用在端侧最多支持创建4个Cloud DB zone。 开发者可以多次打开某个 Cloud DB zone,但每次使用完 Cloud DB zone后,都需要关闭该 Cloud DB zone,即每个打开操作需要一个对应的关闭操作,否则,会在删除 Cloud DB zone 时,抛出异常。 当使用 AGCCloudDBZoneConfig 对象打开一个已有的Cloud DB zone时,需要保证 AGCCloudDBZoneConfig 中指定的属性与已有 Cloud DB zone 的属性一致,如果不一致,系统会抛出异常。

    Parameters

    • config: AGCCloudDBZoneConfig

      AGCCloudDBZoneConfig object, which is used to create or open a configuration file of Cloud DB zone.

    • isAllowToCreate: boolean

      Specifies whether to allow Cloud DB zone object creation.

    Returns void

querySupportTypeName

  • querySupportTypeName(): string[]
  • en

    Get all support model type names.

    zh

    获取所有支持的 model 类型名称

    Returns string[]

    support names

setNetwork

  • setNetwork(zoneId: string, enable: boolean): void
  • en

    Developers can invoke this method to open the data synchronization on the local device. Data can be synchronized between the device and the cloud only after data synchronization is enabled. After data synchronization is disabled, data will not be synchronized between the device and the cloud.

    zh

    开发者调用此方法打开端云之间的数据同步开关,开关打开后,端侧和云侧之间才能进行数据同步, 关闭开关后,端侧和云侧之间不再进行数据同步。

    Parameters

    • zoneId: string

      Cloud DB zone name. same zome id.

    • enable: boolean

      Open or close network

    Returns void

targetOff

  • targetOff(node: any): void
  • en

    remove all event listener for the node

    zh

    取消某个节点所有的事件监听

    Parameters

    • node: any

    Returns void

Static callStaticMethod

  • callStaticMethod(...args: (string | number | false | true)[]): any

Generated using TypeDoc