1 | /// <reference types="node" />
|
2 | import { Collection } from './collection';
|
3 | import { CounterResult, MutationResult } from './crudoptypes';
|
4 | import { DurabilityLevel } from './generaltypes';
|
5 | import { NodeCallback } from './utilities';
|
6 | /**
|
7 | * @category Key-Value
|
8 | */
|
9 | export interface IncrementOptions {
|
10 | /**
|
11 | * The initial value to use for the document if it does not already exist.
|
12 | * Not specifying this value indicates the operation should fail if the
|
13 | * document does not exist.
|
14 | */
|
15 | initial?: number;
|
16 | /**
|
17 | * The expiry time that should be set for the document, expressed in seconds.
|
18 | */
|
19 | expiry?: number;
|
20 | /**
|
21 | * Specifies the level of synchronous durability for this operation.
|
22 | */
|
23 | durabilityLevel?: DurabilityLevel;
|
24 | /**
|
25 | * Specifies the number of nodes this operation should be persisted to
|
26 | * before it is considered successful. Note that this option is mutually
|
27 | * exclusive of {@link durabilityLevel}.
|
28 | */
|
29 | durabilityPersistTo?: number;
|
30 | /**
|
31 | * Specifies the number of nodes this operation should be replicated to
|
32 | * before it is considered successful. Note that this option is mutually
|
33 | * exclusive of {@link durabilityLevel}.
|
34 | */
|
35 | durabilityReplicateTo?: number;
|
36 | /**
|
37 | * The timeout for this operation, represented in milliseconds.
|
38 | */
|
39 | timeout?: number;
|
40 | }
|
41 | /**
|
42 | * @category Key-Value
|
43 | */
|
44 | export interface DecrementOptions {
|
45 | /**
|
46 | * The initial value to use for the document if it does not already exist.
|
47 | * Not specifying this value indicates the operation should fail if the
|
48 | * document does not exist.
|
49 | */
|
50 | initial?: number;
|
51 | /**
|
52 | * The expiry time that should be set for the document, expressed in seconds.
|
53 | */
|
54 | expiry?: number;
|
55 | /**
|
56 | * Specifies the level of synchronous durability for this operation.
|
57 | */
|
58 | durabilityLevel?: DurabilityLevel;
|
59 | /**
|
60 | * Specifies the number of nodes this operation should be persisted to
|
61 | * before it is considered successful. Note that this option is mutually
|
62 | * exclusive of {@link durabilityLevel}.
|
63 | */
|
64 | durabilityPersistTo?: number;
|
65 | /**
|
66 | * Specifies the number of nodes this operation should be replicated to
|
67 | * before it is considered successful. Note that this option is mutually
|
68 | * exclusive of {@link durabilityLevel}.
|
69 | */
|
70 | durabilityReplicateTo?: number;
|
71 | /**
|
72 | * The timeout for this operation, represented in milliseconds.
|
73 | */
|
74 | timeout?: number;
|
75 | }
|
76 | /**
|
77 | * @category Key-Value
|
78 | */
|
79 | export interface AppendOptions {
|
80 | /**
|
81 | * Specifies the level of synchronous durability for this operation.
|
82 | */
|
83 | durabilityLevel?: DurabilityLevel;
|
84 | /**
|
85 | * Specifies the number of nodes this operation should be persisted to
|
86 | * before it is considered successful. Note that this option is mutually
|
87 | * exclusive of {@link durabilityLevel}.
|
88 | */
|
89 | durabilityPersistTo?: number;
|
90 | /**
|
91 | * Specifies the number of nodes this operation should be replicated to
|
92 | * before it is considered successful. Note that this option is mutually
|
93 | * exclusive of {@link durabilityLevel}.
|
94 | */
|
95 | durabilityReplicateTo?: number;
|
96 | /**
|
97 | * The timeout for this operation, represented in milliseconds.
|
98 | */
|
99 | timeout?: number;
|
100 | }
|
101 | /**
|
102 | * @category Key-Value
|
103 | */
|
104 | export interface PrependOptions {
|
105 | /**
|
106 | * Specifies the level of synchronous durability for this operation.
|
107 | */
|
108 | durabilityLevel?: DurabilityLevel;
|
109 | /**
|
110 | * Specifies the number of nodes this operation should be persisted to
|
111 | * before it is considered successful. Note that this option is mutually
|
112 | * exclusive of {@link durabilityLevel}.
|
113 | */
|
114 | durabilityPersistTo?: number;
|
115 | /**
|
116 | * Specifies the number of nodes this operation should be replicated to
|
117 | * before it is considered successful. Note that this option is mutually
|
118 | * exclusive of {@link durabilityLevel}.
|
119 | */
|
120 | durabilityReplicateTo?: number;
|
121 | /**
|
122 | * The timeout for this operation, represented in milliseconds.
|
123 | */
|
124 | timeout?: number;
|
125 | }
|
126 | /**
|
127 | * Exposes a number of binary-level operations against a collection.
|
128 | * These operations do not adhere to the standard JSON-centric
|
129 | * behaviour of the SDK.
|
130 | *
|
131 | * @category Core
|
132 | */
|
133 | export declare class BinaryCollection {
|
134 | private _coll;
|
135 | /**
|
136 | * @internal
|
137 | */
|
138 | constructor(parent: Collection);
|
139 | /**
|
140 | * Increments the ASCII value of the specified key by the amount
|
141 | * indicated in the delta parameter.
|
142 | *
|
143 | * @param key The key to increment.
|
144 | * @param delta The amount to increment the key.
|
145 | * @param options Optional parameters for this operation.
|
146 | * @param callback A node-style callback to be invoked after execution.
|
147 | */
|
148 | increment(key: string, delta: number, options?: IncrementOptions, callback?: NodeCallback<CounterResult>): Promise<CounterResult>;
|
149 | /**
|
150 | * Decrements the ASCII value of the specified key by the amount
|
151 | * indicated in the delta parameter.
|
152 | *
|
153 | * @param key The key to increment.
|
154 | * @param delta The amount to increment the key.
|
155 | * @param options Optional parameters for this operation.
|
156 | * @param callback A node-style callback to be invoked after execution.
|
157 | */
|
158 | decrement(key: string, delta: number, options?: DecrementOptions, callback?: NodeCallback<CounterResult>): Promise<CounterResult>;
|
159 | /**
|
160 | * Appends the specified value to the end of the specified key.
|
161 | *
|
162 | * @param key The key to append to.
|
163 | * @param value The value to adjoin to the end of the document.
|
164 | * @param options Optional parameters for this operation.
|
165 | * @param callback A node-style callback to be invoked after execution.
|
166 | */
|
167 | append(key: string, value: string | Buffer, options?: AppendOptions, callback?: NodeCallback<MutationResult>): Promise<MutationResult>;
|
168 | /**
|
169 | * Prepends the specified value to the beginning of the specified key.
|
170 | *
|
171 | * @param key The key to prepend to.
|
172 | * @param value The value to adjoin to the beginning of the document.
|
173 | * @param options Optional parameters for this operation.
|
174 | * @param callback A node-style callback to be invoked after execution.
|
175 | */
|
176 | prepend(key: string, value: string | Buffer, options?: PrependOptions, callback?: NodeCallback<MutationResult>): Promise<MutationResult>;
|
177 | }
|