sqlcplugin

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package sqlcplugin generates pgmesh query wrappers from sqlc metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

Generate implements sqlc's CodegenService.Generate hook.

Types

type Options

type Options struct {
	// OutputFileName is the generated Go file name.
	OutputFileName string `json:"output_file_name"`
	// SourcePackage is the package containing the source query types.
	SourcePackage string `json:"source_package"`

	// PackageName is the package clause used in generated code.
	PackageName string `json:"package"`
	// InternalImportPath imports sqlc output when wrappers use a separate package.
	InternalImportPath string `json:"internal_import_path"`
	// InternalImportAlias overrides the imported sqlc package qualifier.
	InternalImportAlias string `json:"internal_import_alias"`
	// InterfaceName is the sqlc-generated interface the store must implement.
	InterfaceName string `json:"interface"`
	// TypeName is the combined read-write wrapper type name.
	TypeName string `json:"type"`
	// TargetTypeName is the sqlc-generated query type name.
	TargetTypeName string `json:"target_type"`
	// ConstructorName is the combined wrapper constructor name.
	ConstructorName string `json:"constructor"`
	// TargetConstructorName is the sqlc-generated query constructor name.
	TargetConstructorName string `json:"target_constructor"`
	// ReceiverName is the receiver identifier used by generated methods.
	ReceiverName string `json:"receiver"`
	// SkipWithTx requests omission of transaction methods and is currently unsupported.
	SkipWithTx bool `json:"skip_with_tx"`
	// IgnoreMirrorError makes generated writes discard non-NoRows mirror errors.
	IgnoreMirrorError bool `json:"ignore_mirror_error"`
	// ReadInterfaceName is the generated read-only interface name.
	ReadInterfaceName string `json:"read_interface"`
	// WriteInterfaceName is the generated write interface name.
	WriteInterfaceName string `json:"write_interface"`
	// StoreInterfaceName is the generated combined query interface name.
	StoreInterfaceName string `json:"store_interface"`
	// ReadTypeName is the generated read-only wrapper type name.
	ReadTypeName string `json:"read_type"`
	// WriteTypeName is the generated primary-capable wrapper type name.
	WriteTypeName string `json:"write_type"`
	// ReadConstructorName is the read-only wrapper constructor name.
	ReadConstructorName string `json:"read_constructor"`
	// WriteConstructorName is the primary-capable wrapper constructor name.
	WriteConstructorName string `json:"write_constructor"`
	// RuntimeImportPath is the import path for the pgmesh runtime package.
	RuntimeImportPath string `json:"runtime_import_path"`
	// NodeConstructorName is the generated database node constructor name.
	NodeConstructorName string `json:"node_constructor"`
	// ResolverInterfaceName is the generated shard resolver interface name.
	ResolverInterfaceName string `json:"resolver_interface"`
	// ShardedTypeName is the generated routed facade type name.
	ShardedTypeName string `json:"sharded_type"`
	// ShardedConstructor is the routed facade constructor name.
	ShardedConstructor string `json:"sharded_constructor"`

	// SQLPackage selects the sqlc database driver; only pgx/v5 is supported.
	SQLPackage string `json:"sql_package"`
	// QueryParameterLimit matches sqlc's threshold for generating parameter structs.
	QueryParameterLimit *int32 `json:"query_parameter_limit"`
	// EmitParamsStructPointers matches sqlc's parameter-struct pointer setting.
	EmitParamsStructPointers bool `json:"emit_params_struct_pointers"`
	// EmitResultStructPointers matches sqlc's result-struct pointer setting.
	EmitResultStructPointers bool `json:"emit_result_struct_pointers"`
	// EmitPointersForNullTypes matches sqlc's nullable-type pointer setting.
	EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types"`
	// EmitPointersForNullEnumType overrides pointer emission for nullable enums.
	EmitPointersForNullEnumType *bool `json:"emit_pointers_for_null_enum_types"`
	// EmitExactTableNames preserves table names when deriving generated Go types.
	EmitExactTableNames bool `json:"emit_exact_table_names"`
	// Rename maps SQL identifiers to generated Go identifiers.
	Rename map[string]string `json:"rename"`
	// Overrides applies sqlc-compatible database and column type overrides.
	Overrides []override `json:"overrides"`
}

Options are the sqlc plugin options for the store wrapper generator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL