Skip to content

Commit a6b4d49

Browse files
committed
removed callbacks
1 parent b8e24dc commit a6b4d49

File tree

2 files changed

+28
-49
lines changed

2 files changed

+28
-49
lines changed

samples/document-snippets/row.js

+10-30
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Bigtable = require('@google-cloud/bigtable');
1717
const bigtable = new Bigtable();
1818

1919
const snippets = {
20-
createRow: (instanceId, tableId, callback) => {
20+
createRow: (instanceId, tableId) => {
2121
const instance = bigtable.instance(instanceId);
2222
const table = instance.table(tableId);
2323

@@ -33,11 +33,9 @@ const snippets = {
3333
// Handle the error.
3434
});
3535
// [END bigtable_create_row]
36-
37-
callback();
3836
},
3937

40-
createRules: (instanceId, tableId, callback) => {
38+
createRules: (instanceId, tableId) => {
4139
const instance = bigtable.instance(instanceId);
4240
const table = instance.table(tableId);
4341

@@ -75,11 +73,9 @@ const snippets = {
7573
// Handle the error.
7674
});
7775
// [END bigtable_create_rules]
78-
79-
callback();
8076
},
8177

82-
deleteAllCells: (instanceId, tableId, callback) => {
78+
deleteAllCells: (instanceId, tableId) => {
8379
const instance = bigtable.instance(instanceId);
8480
const table = instance.table(tableId);
8581

@@ -94,11 +90,9 @@ const snippets = {
9490
// Handle the error.
9591
});
9692
// [END bigtable_delete_all_cells]
97-
98-
callback();
9993
},
10094

101-
deleteCells: (instanceId, tableId, callback) => {
95+
deleteCells: (instanceId, tableId) => {
10296
const instance = bigtable.instance(instanceId);
10397
const table = instance.table(tableId);
10498

@@ -122,11 +116,9 @@ const snippets = {
122116
// Handle the error.
123117
});
124118
// [END bigtable_delete_particular_cells]
125-
126-
callback();
127119
},
128120

129-
exists: (instanceId, tableId, callback) => {
121+
exists: (instanceId, tableId) => {
130122
const instance = bigtable.instance(instanceId);
131123
const table = instance.table(tableId);
132124

@@ -142,11 +134,9 @@ const snippets = {
142134
// Handle the error.
143135
});
144136
// [END bigtable_row_exists]
145-
146-
callback();
147137
},
148138

149-
filter: (instanceId, tableId, callback) => {
139+
filter: (instanceId, tableId) => {
150140
const instance = bigtable.instance(instanceId);
151141
const table = instance.table(tableId);
152142

@@ -189,11 +179,9 @@ const snippets = {
189179
// Handle the error.
190180
});
191181
// [END bigtable_row_filter]
192-
193-
callback();
194182
},
195183

196-
get: (instanceId, tableId, callback) => {
184+
get: (instanceId, tableId) => {
197185
const instance = bigtable.instance(instanceId);
198186
const table = instance.table(tableId);
199187

@@ -226,11 +214,9 @@ const snippets = {
226214
// });
227215

228216
// [END bigtable_get_row]
229-
230-
callback();
231217
},
232218

233-
getMetadata: (instanceId, tableId, callback) => {
219+
getMetadata: (instanceId, tableId) => {
234220
const instance = bigtable.instance(instanceId);
235221
const table = instance.table(tableId);
236222

@@ -247,11 +233,9 @@ const snippets = {
247233
// Handle the error.
248234
});
249235
// [END bigtable_get_row_meta]
250-
251-
callback();
252236
},
253237

254-
increment: (instanceId, tableId, callback) => {
238+
increment: (instanceId, tableId) => {
255239
const instance = bigtable.instance(instanceId);
256240
const table = instance.table(tableId);
257241

@@ -283,11 +267,9 @@ const snippets = {
283267
// Handle the error.
284268
});
285269
// [END bigtable_row_increment]
286-
287-
callback();
288270
},
289271

290-
save: (instanceId, tableId, callback) => {
272+
save: (instanceId, tableId) => {
291273
const instance = bigtable.instance(instanceId);
292274
const table = instance.table(tableId);
293275

@@ -307,8 +289,6 @@ const snippets = {
307289
// Handle the error.
308290
});
309291
// [END bigtable_row_save]
310-
311-
callback();
312292
},
313293
};
314294

samples/document-snippets/tests/row.js

+18-19
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const bigtable = new Bigtable();
2424
const INSTANCE_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules
2525
const CLUSTER_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules
2626
const TABLE_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtable naming rules
27-
// const FAMILY_ID = `sample-family-${uuid.v4()}`.substr(0, 10); // Bigtable naming rules
2827

2928
const rowSnippets = require('../row.js');
3029

@@ -49,31 +48,31 @@ describe('Row Snippets', function() {
4948
await instance.delete();
5049
});
5150

52-
it('should create a row', done => {
53-
rowSnippets.createRow(INSTANCE_ID, TABLE_ID, done);
51+
it('should create a row', () => {
52+
rowSnippets.createRow(INSTANCE_ID, TABLE_ID);
5453
});
55-
it('should create a row rules', done => {
56-
rowSnippets.createRules(INSTANCE_ID, TABLE_ID, done);
54+
it('should create a row rules', () => {
55+
rowSnippets.createRules(INSTANCE_ID, TABLE_ID);
5756
});
58-
it('should delete all cells', done => {
59-
rowSnippets.deleteAllCells(INSTANCE_ID, TABLE_ID, done);
57+
it('should delete all cells', () => {
58+
rowSnippets.deleteAllCells(INSTANCE_ID, TABLE_ID);
6059
});
61-
it('should delete selected cells', done => {
62-
rowSnippets.deleteCells(INSTANCE_ID, TABLE_ID, done);
60+
it('should delete selected cells', () => {
61+
rowSnippets.deleteCells(INSTANCE_ID, TABLE_ID);
6362
});
64-
it('should check row exists', done => {
65-
rowSnippets.exists(INSTANCE_ID, TABLE_ID, done);
63+
it('should check row exists', () => {
64+
rowSnippets.exists(INSTANCE_ID, TABLE_ID);
6665
});
67-
it('should mutate row with matched filter', done => {
68-
rowSnippets.filter(INSTANCE_ID, TABLE_ID, done);
66+
it('should mutate row with matched filter', () => {
67+
rowSnippets.filter(INSTANCE_ID, TABLE_ID);
6968
});
70-
it('should get row meta-data', done => {
71-
rowSnippets.getMetadata(INSTANCE_ID, TABLE_ID, done);
69+
it('should get row meta-data', () => {
70+
rowSnippets.getMetadata(INSTANCE_ID, TABLE_ID);
7271
});
73-
it('should increment row', done => {
74-
rowSnippets.increment(INSTANCE_ID, TABLE_ID, done);
72+
it('should increment row', () => {
73+
rowSnippets.increment(INSTANCE_ID, TABLE_ID);
7574
});
76-
it('should save row', done => {
77-
rowSnippets.save(INSTANCE_ID, TABLE_ID, done);
75+
it('should save row', () => {
76+
rowSnippets.save(INSTANCE_ID, TABLE_ID);
7877
});
7978
});

0 commit comments

Comments
 (0)