@wuapi/generator
Version:
39 lines (38 loc) • 1.18 kB
TypeScript
/// <reference types="chance" />
import { $Project, $ElementPath, $Entity, $FieldType } from "@wuapi/essential";
import { BraceCaller } from "../brace";
export default class DemoGenerator {
project: $Project;
path: $ElementPath;
get entity(): $Entity;
chance: Chance.Chance;
constructor(project: $Project, path: $ElementPath);
genericTypeName(type: $FieldType): string;
/**
* Generate field value
*
* @param ft The $FieldType object preresenting this field.
* @param config The demo configuration of this field.
*
* @returns The field value as string
*/
generateField(ft: $FieldType, config: {
[key: string]: string;
} | null): String;
/**
* Write function getter of thie field.
*
* @param b The BraceCaller for output
* @param isPublic true if the output function is public, private otherwise.
*/
asFunction(b: BraceCaller, isPublic?: boolean): void;
/**
* Write function body to output
*
* @param b The BraceCaller for output
* @param idx The index holder
*/
asFunctionBody(b: BraceCaller, idx?: {
n: number;
}): void;
}