• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkData
19 */
20
21import collections from '../arkts/@arkts.collections';
22import lang from '../arkts/@arkts.lang';
23import relationalStore from './@ohos.data.relationalStore';
24
25/**
26 * Provides methods for creating and deleting an RDB store.
27 *
28 * @namespace sendableRelationalStore
29 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
30 * @since 12
31 */
32declare namespace sendableRelationalStore {
33  /**
34   * Defines information of an asset.
35   *
36   * @interface Asset
37   * @extends lang.ISendable
38   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
39   * @since 12
40   */
41  interface Asset extends lang.ISendable {
42    /**
43     * Name of the asset.
44     *
45     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
46     * @since 12
47     */
48    name: string;
49
50    /**
51     * URI of the asset.
52     *
53     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
54     * @since 12
55     */
56    uri: string;
57
58    /**
59     * Path of the asset.
60     *
61     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
62     * @since 12
63     */
64    path: string;
65
66    /**
67     * Time when the asset was created.
68     *
69     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
70     * @since 12
71     */
72    createTime: string;
73
74    /**
75     * Time when the asset was last modified.
76     *
77     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
78     * @since 12
79     */
80    modifyTime: string;
81
82    /**
83     * Size of the asset.
84     *
85     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
86     * @since 12
87     */
88    size: string;
89
90    /**
91     * Status of the asset.
92     *
93     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
94     * @since 12
95     */
96    status?: number;
97  }
98
99  /**
100   * Defines multiple assets in a column.
101   *
102   * @typedef { collections.Array<Asset> } Assets
103   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
104   * @since 12
105   */
106  type Assets = collections.Array<Asset>;
107
108  /**
109   * Defines the types of the value in a KV pair.
110   *
111   * @typedef { null | number | string | boolean | collections.Uint8Array | Asset | Assets |
112   * collections.Float32Array | bigint } ValueType
113   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
114   * @since 12
115   */
116  type ValueType = null | number | string | boolean | collections.Uint8Array | Asset | Assets |
117    collections.Float32Array | bigint;
118
119  /**
120   * Defines the data stored in KV pairs in a ValuesBucket object.
121   *
122   * @typedef { collections.Map<string, ValueType> } ValuesBucket
123   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
124   * @since 12
125   */
126  type ValuesBucket = collections.Map<string, ValueType>;
127
128  /**
129   * Defines NonSendableBucket for convenience.
130   *
131   * @typedef { relationalStore.ValuesBucket } NonSendableBucket
132   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
133   * @since 12
134   */
135  type NonSendableBucket = relationalStore.ValuesBucket;
136
137  /**
138   * Defines NonSendableAsset for convenience.
139   *
140   * @typedef { relationalStore.Asset } NonSendableAsset
141   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
142   * @since 12
143   */
144  type NonSendableAsset = relationalStore.Asset;
145
146  /**
147   * Converts a sendable <b>valuesBucket</b> object to a non-sendable <b>valuesBucket</b> object.
148   *
149   * @param { ValuesBucket } valuesBucket - Indicates the sendable <b>valuesBucket</b> object to convert.
150   * @returns { NonSendableBucket } a non-sendable <b>valuesBucket</b> object. For details,
151   *   see {@link NonSendableBucket}.
152   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
153   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
154   * @throws { BusinessError } 14800000 - Inner error.
155   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
156   * @since 12
157   */
158  function fromSendableValuesBucket(valuesBucket: ValuesBucket): NonSendableBucket;
159
160  /**
161   * Converts a non-sendable <b>valuesBucket</b> object to a sendable <b>valuesBucket</b> object.
162   *
163   * @param { NonSendableBucket } valuesBucket - Indicates the non-sendable <b>valuesBucket</b> object to convert.
164   * @returns { ValuesBucket } a sendable <b>valuesBucket</b> object. For details, see {@link ValuesBucket}.
165   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
166   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
167   * @throws { BusinessError } 14800000 - Inner error.
168   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
169   * @since 12
170   */
171  function toSendableValuesBucket(valuesBucket: NonSendableBucket): ValuesBucket;
172
173    /**
174   * Converts a sendable <b>asset</b> object to a non-sendable <b>asset</b> object.
175   *
176   * @param { Asset } asset - Indicates the sendable <b>asset</b> object to convert.
177   * @returns { NonSendableAsset } a non-sendable <b>asset</b> object. For details, see {@link NonSendableAsset}.
178   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
179   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
180   * @throws { BusinessError } 14800000 - Inner error.
181   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
182   * @since 12
183   */
184  function fromSendableAsset(asset: Asset): NonSendableAsset;
185
186  /**
187   * Converts a non-sendable <b>asset</b> object to a sendable <b>asset</b> object.
188   *
189   * @param { NonSendableAsset } asset - Indicates the non-sendable <b>asset</b> object to convert.
190   * @returns { Asset } a sendable <b>asset</b> object. For details, see {@link Asset}.
191   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
192   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
193   * @throws { BusinessError } 14800000 - Inner error.
194   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
195   * @since 12
196   */
197  function toSendableAsset(asset: NonSendableAsset): Asset;
198
199  /**
200   * Defines NonSendableValues for convenience.
201   *
202   * @typedef { Array<relationalStore.ValueType> } NonSendableValues
203   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
204   * @since 20
205   */
206  type NonSendableValues = Array<relationalStore.ValueType>;
207
208  /**
209   * Converts a sendable collections.Array<ValueType> to a non-sendable Array<relationalStore.ValueType>.
210   *
211   * @param { collections.Array<ValueType> } values - Indicates the sendable collections.Array<ValueType> to convert.
212   * @returns { NonSendableValues } a non-sendable Array<relationalStore.ValueType>. For details,
213   *   see {@link NonSendableValues}.
214   * @throws { BusinessError } 14800000 - Inner error.
215   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
216   * @since 20
217   */
218  function fromSendableValues(values: collections.Array<ValueType>): NonSendableValues;
219
220  /**
221   * Converts a non-sendable Array<relationalStore.ValueType> to a collections.Array<ValueType>t.
222   *
223   * @param { NonSendableValues } values - Indicates the non-sendable Array<relationalStore.ValueType> to convert.
224   * @returns { collections.Array<ValueType> } a sendable collections.Array<ValueType>.
225   * @throws { BusinessError } 14800000 - Inner error.
226   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
227   * @since 20
228   */
229  function toSendableValues(values: NonSendableValues): collections.Array<ValueType>;
230}
231
232export default sendableRelationalStore;