Skip to content

Commit c7a08a8

Browse files
chore(cloud-rad): Add code fencing (#893)
* fix caption * chore(cloud-rad): Add code fencing Code examples need code fencing around them to distingish from rich text for TSDoc. Internally b/179483748 Script used: https://github.com/fhinkel/cloud-rad-script/blob/main/fixExampleComments.js * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 152b90c commit c7a08a8

File tree

8 files changed

+209
-19
lines changed

8 files changed

+209
-19
lines changed

src/entity.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ export namespace entity {
5555
* @param {number} value The double value.
5656
*
5757
* @example
58+
* ```
5859
* const {Datastore} = require('@google-cloud/datastore');
5960
* const datastore = new Datastore();
6061
* const aDouble = datastore.double(7.3);
62+
* ```
6163
*/
6264
export class Double {
6365
type: string;
@@ -119,9 +121,11 @@ export namespace entity {
119121
* names to be converted using `integerTypeCastFunction`.
120122
*
121123
* @example
124+
* ```
122125
* const {Datastore} = require('@google-cloud/datastore');
123126
* const datastore = new Datastore();
124127
* const anInt = datastore.int(7);
128+
* ```
125129
*/
126130
export class Int extends Number {
127131
type: string;
@@ -235,6 +239,7 @@ export namespace entity {
235239
* @param {number} coordinates.longitude Longitudinal value.
236240
*
237241
* @example
242+
* ```
238243
* const {Datastore} = require('@google-cloud/datastore');
239244
* const datastore = new Datastore();
240245
* const coordinates = {
@@ -243,6 +248,7 @@ export namespace entity {
243248
* };
244249
*
245250
* const geoPoint = datastore.geoPoint(coordinates);
251+
* ```
246252
*/
247253
export class GeoPoint {
248254
value: Coordinates;
@@ -284,22 +290,27 @@ export namespace entity {
284290
* @param {string} [options.namespace] Optional namespace.
285291
*
286292
* @example
293+
* ```
287294
* //-
288295
* // Create an incomplete key with a kind value of `Company`.
289296
* //-
290297
* const {Datastore} = require('@google-cloud/datastore');
291298
* const datastore = new Datastore();
292299
* const key = datastore.key('Company');
293300
*
301+
* ```
294302
* @example
303+
* ```
295304
* //-
296305
* // Create a complete key with a kind value of `Company` and id`123`.
297306
* //-
298307
* const {Datastore} = require('@google-cloud/datastore');
299308
* const datastore = new Datastore();
300309
* const key = datastore.key(['Company', 123]);
301310
*
311+
* ```
302312
* @example
313+
* ```
303314
* //-
304315
* // If the ID integer is outside the bounds of a JavaScript Number
305316
* // object, create an Int.
@@ -311,14 +322,18 @@ export namespace entity {
311322
* datastore.int('100000000000001234')
312323
* ]);
313324
*
325+
* ```
314326
* @example
327+
* ```
315328
* const {Datastore} = require('@google-cloud/datastore');
316329
* const datastore = new Datastore();
317330
* // Create a complete key with a kind value of `Company` and name `Google`.
318331
* // Note: `id` is used for numeric identifiers and `name` is used otherwise.
319332
* const key = datastore.key(['Company', 'Google']);
320333
*
334+
* ```
321335
* @example
336+
* ```
322337
* //-
323338
* // Create a complete key from a provided namespace and path.
324339
* //-
@@ -329,7 +344,9 @@ export namespace entity {
329344
* path: ['Company', 123]
330345
* });
331346
*
332-
* @example <caption>Serialize the key for later re-use.</caption>
347+
* ```
348+
* @example Serialize the key for later re-use.
349+
* ```
333350
* const {Datastore} = require('@google-cloud/datastore');
334351
* const datastore = new Datastore();
335352
* const key = datastore.key({
@@ -338,6 +355,7 @@ export namespace entity {
338355
* });
339356
* // Later...
340357
* const key = datastore.key(key.serialized);
358+
* ```
341359
*/
342360
export class Key {
343361
namespace?: string;
@@ -400,13 +418,15 @@ export namespace entity {
400418
* @returns {object}
401419
*
402420
* @example
421+
* ```
403422
* const key = datastore.key({
404423
* namespace: 'My-NS',
405424
* path: ['Company', 123]
406425
* });
407426
*
408427
* // Later...
409428
* const key = datastore.key(key.serialized);
429+
* ```
410430
*/
411431
get serialized() {
412432
const serializedKey = {
@@ -484,6 +504,7 @@ export namespace entity {
484504
* @returns {*}
485505
*
486506
* @example
507+
* ```
487508
* decodeValueProto({
488509
* booleanValue: false
489510
* });
@@ -498,6 +519,7 @@ export namespace entity {
498519
* blobValue: Buffer.from('68656c6c6f')
499520
* });
500521
* // <Buffer 68 65 6c 6c 6f>
522+
* ```
501523
*/
502524
export function decodeValueProto(
503525
valueProto: ValueProto,
@@ -561,10 +583,12 @@ export namespace entity {
561583
* @returns {object}
562584
*
563585
* @example
586+
* ```
564587
* encodeValue('Hi');
565588
* // {
566589
* // stringValue: 'Hi'
567590
* // }
591+
* ```
568592
*/
569593
// eslint-disable-next-line @typescript-eslint/no-explicit-any
570594
export function encodeValue(value: any, property: string): ValueProto {
@@ -683,6 +707,7 @@ export namespace entity {
683707
* @returns {object}
684708
*
685709
* @example
710+
* ```
686711
* entityFromEntityProto({
687712
* properties: {
688713
* map: {
@@ -698,6 +723,7 @@ export namespace entity {
698723
* // {
699724
* // name: 'Stephen'
700725
* // }
726+
* ```
701727
*/
702728
// eslint-disable-next-line @typescript-eslint/no-explicit-any
703729
export function entityFromEntityProto(
@@ -725,6 +751,7 @@ export namespace entity {
725751
* @returns {object}
726752
*
727753
* @example
754+
* ```
728755
* entityToEntityProto({
729756
* excludeFromIndexes: [
730757
* 'name'
@@ -746,6 +773,7 @@ export namespace entity {
746773
* // }
747774
* // }
748775
* // }
776+
* ```
749777
*/
750778
export function entityToEntityProto(entityObject: EntityObject): EntityProto {
751779
const properties = entityObject.data;
@@ -905,6 +933,7 @@ export namespace entity {
905933
* Please see {@link IntegerTypeCastOptions} for options descriptions.
906934
*
907935
* @example
936+
* ```
908937
* request_('runQuery', {}, (err, response) => {
909938
* const entityObjects = formatArray(response.batch.entityResults);
910939
* // {
@@ -915,6 +944,7 @@ export namespace entity {
915944
* // }
916945
* //
917946
* });
947+
* ```
918948
*/
919949
export function formatArray(
920950
results: ResponseResult[],
@@ -984,8 +1014,10 @@ export namespace entity {
9841014
* @returns {boolean}
9851015
*
9861016
* @example
1017+
* ```
9871018
* isKeyComplete(new Key(['Company', 'Google'])); // true
9881019
* isKeyComplete(new Key('Company')); // false
1020+
* ```
9891021
*/
9901022
export function isKeyComplete(key: Key) {
9911023
const lastPathElement = entity.keyToKeyProto(key).path!.pop()!;
@@ -1000,6 +1032,7 @@ export namespace entity {
10001032
* @returns {Key}
10011033
*
10021034
* @example
1035+
* ```
10031036
* const key = keyFromKeyProto({
10041037
* partitionId: {
10051038
* projectId: 'project-id',
@@ -1012,6 +1045,7 @@ export namespace entity {
10121045
* }
10131046
* ]
10141047
* });
1048+
* ```
10151049
*/
10161050
export function keyFromKeyProto(keyProto: KeyProto): Key {
10171051
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1052,6 +1086,7 @@ export namespace entity {
10521086
* @returns {object}
10531087
*
10541088
* @example
1089+
* ```
10551090
* const keyProto = keyToKeyProto(new Key(['Company', 1]));
10561091
* // {
10571092
* // path: [
@@ -1061,6 +1096,7 @@ export namespace entity {
10611096
* // }
10621097
* // ]
10631098
* // }
1099+
* ```
10641100
*/
10651101
export function keyToKeyProto(key: Key): KeyProto {
10661102
if (is.undefined(key.kind)) {
@@ -1118,6 +1154,7 @@ export namespace entity {
11181154
* @returns {object}
11191155
*
11201156
* @example
1157+
* ```
11211158
* queryToQueryProto({
11221159
* namespace: '',
11231160
* kinds: [
@@ -1142,6 +1179,7 @@ export namespace entity {
11421179
* // order: [],
11431180
* // groupBy: []
11441181
* // }
1182+
* ```
11451183
*/
11461184
export function queryToQueryProto(query: Query): QueryProto {
11471185
const OP_TO_OPERATOR = {

src/index-class.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ export type IIndex = google.datastore.admin.v1.IIndex;
6262
* @param {string} id The index name or id.
6363
*
6464
* @example
65+
* ```
6566
* const {Datastore} = require('@google-cloud/datastore');
6667
* const datastore = new Datastore();
6768
* const index = datastore.index('my-index');
69+
* ```
6870
*/
6971
export class Index {
7072
datastore: Datastore;

0 commit comments

Comments
 (0)