From c0b4e976d068294a34a38df96113c61285ef53d1 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 6 Feb 2022 11:24:05 +0100 Subject: docs: improve database jsdocs (#424) --- src/database.ts | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'src/database.ts') diff --git a/src/database.ts b/src/database.ts index abfaea85..3e3b56f9 100644 --- a/src/database.ts +++ b/src/database.ts @@ -1,5 +1,8 @@ import type { Faker } from '.'; +/** + * Module to generate database related entries. + */ export class Database { constructor(private readonly faker: Faker) { // Bind `this` so namespaced is working correctly @@ -9,34 +12,13 @@ export class Database { } this[name] = this[name].bind(this); } - - // TODO @Shinigami92 2022-01-11: We should find a better strategy as assigning this property to a function - // @ts-expect-error - this.column.schema = { - description: 'Generates a column name.', - sampleResults: ['id', 'title', 'createdAt'], - }; - // @ts-expect-error - this.type.schema = { - description: 'Generates a column type.', - sampleResults: ['byte', 'int', 'varchar', 'timestamp'], - }; - // @ts-expect-error - this.collation.schema = { - description: 'Generates a collation.', - sampleResults: ['utf8_unicode_ci', 'utf8_bin'], - }; - // @ts-expect-error - this.engine.schema = { - description: 'Generates a storage engine.', - sampleResults: ['MyISAM', 'InnoDB'], - }; } /** - * column + * Returns a random database column name. * - * @method faker.database.column + * @example + * faker.database.column() // 'createdAt' */ column(): string { return this.faker.random.arrayElement( @@ -45,18 +27,20 @@ export class Database { } /** - * type + * Returns a random database column type. * - * @method faker.database.type + * @example + * faker.database.type() // 'timestamp' */ type(): string { return this.faker.random.arrayElement(this.faker.definitions.database.type); } /** - * collation + * Returns a random database collation. * - * @method faker.database.collation + * @example + * faker.database.collation() // 'utf8_unicode_ci' */ collation(): string { return this.faker.random.arrayElement( @@ -65,9 +49,10 @@ export class Database { } /** - * engine + * Returns a random database engine. * - * @method faker.database.engine + * @example + * faker.database.engine() // 'ARCHIVE' */ engine(): string { return this.faker.random.arrayElement( -- cgit v1.2.3