Documentation
¶
Index ¶
- func EnsureRuntimeScaffolds(root, modulePath string) error
- func GraphQLModelTypeMappings() map[string][]string
- func GraphQLModelsSection(modulePath string) string
- func RegisterGraphQLScalarTemplate(content []byte)
- func SetGQLRunnerForTest(fn func(string) error) func()
- type ColumnSnapshot
- type ComponentName
- type ComponentResult
- type Entity
- type ForeignKeySnapshot
- type GenerateOptions
- type IndexSnapshot
- type MigrationFile
- type MigrationResult
- type Operation
- type OperationKind
- type RunResult
- type SchemaDiscoveryError
- type SchemaSnapshot
- type SchemaValidationError
- type SchemaValidationErrorList
- type TableSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureRuntimeScaffolds ¶
EnsureRuntimeScaffolds materialises the runtime scaffolding packages required by generated code. It writes files only when they are absent so repeated executions remain idempotent.
func GraphQLModelTypeMappings ¶
GraphQLModelTypeMappings returns a defensive copy of the scalar-to-Go type mappings used when scaffolding gqlgen configuration.
func GraphQLModelsSection ¶
GraphQLModelsSection renders the gqlgen `models` configuration block using the shared scalar mappings and built-in scalar aliases.
func RegisterGraphQLScalarTemplate ¶
func RegisterGraphQLScalarTemplate(content []byte)
RegisterGraphQLScalarTemplate provides the default scalars helper template used when ensuring GraphQL runtime helpers are present during generation. The content is copied to avoid callers mutating the registered template after registration.
func SetGQLRunnerForTest ¶
SetGQLRunnerForTest overrides the gqlgen runner for tests and returns a restore function.
Types ¶
type ColumnSnapshot ¶
type ColumnSnapshot struct {
Name string `json:"name"`
Type string `json:"type"`
Nullable bool `json:"nullable"`
Unique bool `json:"unique,omitempty"`
DefaultExpr string `json:"default_expr,omitempty"`
DefaultNow bool `json:"default_now,omitempty"`
Identity bool `json:"identity,omitempty"`
GeneratedExpr string `json:"generated_expr,omitempty"`
Dependencies []string `json:"dependencies,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
EnumValues []string `json:"enum_values,omitempty"`
}
type ComponentName ¶
type ComponentName string
const ( ComponentORM ComponentName = "orm" ComponentGraphQL ComponentName = "graphql" ComponentMigrations ComponentName = "migrations" )
type ComponentResult ¶
type ForeignKeySnapshot ¶
type GenerateOptions ¶
type IndexSnapshot ¶
type MigrationFile ¶
type MigrationResult ¶
type MigrationResult struct {
Operations []Operation
Files []MigrationFile
Snapshot SchemaSnapshot
}
type Operation ¶
type Operation struct {
Kind OperationKind
Target string
SQL string
}
type OperationKind ¶
type OperationKind string
const ( OpCreateExtension OperationKind = "create_extension" OpDropExtension OperationKind = "drop_extension" OpCreateTable OperationKind = "create_table" OpDropTable OperationKind = "drop_table" OpAddColumn OperationKind = "add_column" OpDropColumn OperationKind = "drop_column" OpAlterColumn OperationKind = "alter_column" OpAddForeignKey OperationKind = "add_foreign_key" OpDropForeignKey OperationKind = "drop_foreign_key" OpAddIndex OperationKind = "add_index" OpDropIndex OperationKind = "drop_index" OpCreateHypertable OperationKind = "create_hypertable" OpDropHypertable OperationKind = "drop_hypertable" OpAddCheck OperationKind = "add_check_constraint" OpDropCheck OperationKind = "drop_check_constraint" )
type RunResult ¶
type RunResult struct {
Components []ComponentResult
Migration MigrationResult
}
type SchemaDiscoveryError ¶
SchemaDiscoveryError captures failures while attempting to load user-authored schema files.
func (SchemaDiscoveryError) Error ¶
func (e SchemaDiscoveryError) Error() string
Error implements the error interface.
func (SchemaDiscoveryError) Suggestion ¶
func (e SchemaDiscoveryError) Suggestion() string
Suggestion aggregates hints for display in CLI error messages.
type SchemaSnapshot ¶
type SchemaSnapshot struct {
Tables []TableSnapshot `json:"tables"`
Extensions []string `json:"extensions,omitempty"`
}
type SchemaValidationError ¶
type SchemaValidationErrorList ¶
type SchemaValidationErrorList struct {
Problems []SchemaValidationError
}
func (*SchemaValidationErrorList) Error ¶
func (l *SchemaValidationErrorList) Error() string
type TableSnapshot ¶
type TableSnapshot struct {
Name string `json:"name"`
Columns []ColumnSnapshot `json:"columns"`
PrimaryKey []string `json:"primary_key,omitempty"`
Indexes []IndexSnapshot `json:"indexes,omitempty"`
ForeignKeys []ForeignKeySnapshot `json:"foreign_keys,omitempty"`
HypertableColumn string `json:"hypertable_column,omitempty"`
IsJoinTable bool `json:"join_table,omitempty"`
}