Artifactinterfaceinterface ArtifactA file a generator makes.
| Member | Type | What it is |
|---|---|---|
path | string | Where it goes, relative to wherever the files are written, with /. |
text | string |
Generators (commons data 0010-sql-generators): what a person or a program reads of a schema is made from it. A generator is a value with an identifier and a function from a logical schema, a naming and an optional dialect to files, a path and a text each, or to error values; it knows no database and reads nothing else. An extension contributes it through the engine's point physical.generators, and generate runs the generators it is given.
Artifactinterfaceinterface ArtifactA file a generator makes.
| Member | Type | What it is |
|---|---|---|
path | string | Where it goes, relative to wherever the files are written, with /. |
text | string |
generatefunctionfunction generate(schema: LogicalSchema, options: GenerateOptions): Result<readonly Artifact[], readonly GenerateError[]>Runs generators over a logical schema.
| Parameter | What it is |
|---|---|
schema | the logical schema |
options | the generators, the naming and the dialect |
Returns: every file, in the order of the generators, or every error
GenerateContextinterfaceno test imports itinterface GenerateContextWhat a generator is given.
| Member | Type | What it is |
|---|---|---|
schema | LogicalSchema | |
naming | Naming | |
dialect? | Dialect | The dialect whose types a generator may write, where one is wanted. |
GenerateErrortypeno test imports ittype GenerateError =
| { readonly kind: "unsupported"; readonly generator: string; readonly element: LogicalId; readonly why: string }
| { readonly kind: "path"; readonly path: string; readonly generators: readonly string[] };What is wrong with a generation; generate returns all of it together.
GenerateOptionsinterfaceno test imports itinterface GenerateOptionsWhat generate is given besides the schema.
| Member | Type | What it is |
|---|---|---|
generators | readonly Generator[] | |
naming? | Naming | How names are written; snake case where none is given. |
dialect? | Dialect |
Generatorinterfaceinterface GeneratorA generator.
| Member | Type | What it is |
|---|---|---|
id | string | |
describe | string | What it makes, in a few words. |
generate | (context: GenerateContext) => Result<readonly Artifact[], readonly GenerateError[]> |
generatorsFromfunctionfunction generatorsFrom(composition: Composition): readonly Generator[]The generators of a composition, in its order.
| Parameter | What it is |
|---|---|
composition | the project's composition |
Returns: the generators its extensions contribute
generatorsPointconstno test imports itconst generatorsPoint: ContributionPoint<Generator>The contribution point an extension fills to add a generator.