Documentation ¶
Overview ¶
Package generator acts as a prisma generator
Index ¶
Constants ¶
const DefaultPackageName = "db"
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run invokes the generator, which builds the templates and writes to the specified output file.
func Transform ¶
func Transform(input *Root)
Transform builds the AST from the flat DMMF so it can be used properly in templates
func TransformBinaryTarget ¶ added in v0.19.0
Types ¶
type BinaryPaths ¶
type BinaryPaths struct { // MigrationEngine (optional) MigrationEngine map[string]string `json:"migrationEngine"` // key target, value path // QueryEngine (optional) QueryEngine map[string]string `json:"queryEngine"` }
BinaryPaths holds the information of the paths to the Prisma binaries.
type BinaryTarget ¶
type Config ¶
type Config struct { EngineType string `json:"engineType"` Package types.String `json:"package"` DisableGitignore string `json:"disableGitignore"` DisableGoBinaries string `json:"disableGoBinaries"` }
Config describes the options for the Prisma Client Go generator
type Datasource ¶
type Datasource struct { Name types.String `json:"name"` Provider Provider `json:"provider"` ActiveProvider Provider `json:"activeProvider"` URL EnvValue `json:"url"` Config interface{} `json:"config"` }
Datasource describes a Prisma data source of any database type.
type EnvValue ¶
type EnvValue struct { // FromEnvVar (optional) FromEnvVar string `json:"fromEnvVar"` Value string `json:"value"` }
EnvValue contains a string value and optionally information if, and if yes from where, an env var is used for this value.
type Generator ¶
type Generator struct { // Output holds the file path of where the client gets generated in. Output *Value `json:"output"` Name types.String `json:"name"` Provider *Value `json:"provider"` Config Config `json:"config"` BinaryTargets []BinaryTarget `json:"binaryTargets"` // PinnedBinaryTarget (optional) PinnedBinaryTarget string `json:"pinnedBinaryTarget"` }
Generator describes a generator defined in the Prisma schema.
type Provider ¶ added in v0.27.0
type Provider string
Provider describes the Database of this datasource.
type Root ¶
type Root struct { Generator Generator `json:"generator"` OtherGenerators []Generator `json:"otherGenerators"` SchemaPath string `json:"schemaPath"` // Version contains the version hash of the Prisma engine Version string `json:"version"` DMMF dmmf.Document `json:"DMMF"` Datasources []Datasource `json:"datasources"` // Datamodel provides the raw string of the Prisma datamodel. Datamodel string `json:"datamodel"` // BinaryPaths (optional) BinaryPaths BinaryPaths `json:"binaryPaths"` AST *transform.AST `json:"ast"` }
Root describes the generator output root.