pluginv1

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Generator_GetInfo_FullMethodName  = "/sqld.v1.plugin.Generator/GetInfo"
	Generator_Generate_FullMethodName = "/sqld.v1.plugin.Generator/Generate"
)

Variables

View Source
var (
	AnnotationForm_name = map[int32]string{
		0: "ANNOTATION_FORM_UNSPECIFIED",
		1: "ANNOTATION_FORM_FLAG",
		2: "ANNOTATION_FORM_SCALAR",
		3: "ANNOTATION_FORM_POSITIONAL",
		4: "ANNOTATION_FORM_KEYED",
		5: "ANNOTATION_FORM_LIST",
		6: "ANNOTATION_FORM_FREEFORM",
	}
	AnnotationForm_value = map[string]int32{
		"ANNOTATION_FORM_UNSPECIFIED": 0,
		"ANNOTATION_FORM_FLAG":        1,
		"ANNOTATION_FORM_SCALAR":      2,
		"ANNOTATION_FORM_POSITIONAL":  3,
		"ANNOTATION_FORM_KEYED":       4,
		"ANNOTATION_FORM_LIST":        5,
		"ANNOTATION_FORM_FREEFORM":    6,
	}
)

Enum value maps for AnnotationForm.

View Source
var (
	AnnotationCardinality_name = map[int32]string{
		0: "ANNOTATION_CARDINALITY_UNSPECIFIED",
		1: "ANNOTATION_CARDINALITY_SINGLE",
		2: "ANNOTATION_CARDINALITY_REPEATED",
	}
	AnnotationCardinality_value = map[string]int32{
		"ANNOTATION_CARDINALITY_UNSPECIFIED": 0,
		"ANNOTATION_CARDINALITY_SINGLE":      1,
		"ANNOTATION_CARDINALITY_REPEATED":    2,
	}
)

Enum value maps for AnnotationCardinality.

View Source
var (
	CommentPlacement_name = map[int32]string{
		0: "COMMENT_PLACEMENT_UNSPECIFIED",
		1: "COMMENT_PLACEMENT_LEADING",
		2: "COMMENT_PLACEMENT_TRAILING",
		3: "COMMENT_PLACEMENT_COMMENT_ON",
		4: "COMMENT_PLACEMENT_ANY",
	}
	CommentPlacement_value = map[string]int32{
		"COMMENT_PLACEMENT_UNSPECIFIED": 0,
		"COMMENT_PLACEMENT_LEADING":     1,
		"COMMENT_PLACEMENT_TRAILING":    2,
		"COMMENT_PLACEMENT_COMMENT_ON":  3,
		"COMMENT_PLACEMENT_ANY":         4,
	}
)

Enum value maps for CommentPlacement.

View Source
var (
	DiagnosticSeverity_name = map[int32]string{
		0: "DIAGNOSTIC_SEVERITY_UNSPECIFIED",
		1: "DIAGNOSTIC_SEVERITY_INFO",
		2: "DIAGNOSTIC_SEVERITY_WARNING",
		3: "DIAGNOSTIC_SEVERITY_ERROR",
	}
	DiagnosticSeverity_value = map[string]int32{
		"DIAGNOSTIC_SEVERITY_UNSPECIFIED": 0,
		"DIAGNOSTIC_SEVERITY_INFO":        1,
		"DIAGNOSTIC_SEVERITY_WARNING":     2,
		"DIAGNOSTIC_SEVERITY_ERROR":       3,
	}
)

Enum value maps for DiagnosticSeverity.

View Source
var (
	QueryCommand_name = map[int32]string{
		0: "QUERY_COMMAND_UNSPECIFIED",
		1: "QUERY_COMMAND_ONE",
		2: "QUERY_COMMAND_MANY",
		3: "QUERY_COMMAND_EXEC",
		4: "QUERY_COMMAND_EXEC_ROWS",
		5: "QUERY_COMMAND_EXEC_RESULT",
		6: "QUERY_COMMAND_EXEC_LASTID",
		7: "QUERY_COMMAND_BATCH_EXEC",
		8: "QUERY_COMMAND_COPY_FROM",
	}
	QueryCommand_value = map[string]int32{
		"QUERY_COMMAND_UNSPECIFIED": 0,
		"QUERY_COMMAND_ONE":         1,
		"QUERY_COMMAND_MANY":        2,
		"QUERY_COMMAND_EXEC":        3,
		"QUERY_COMMAND_EXEC_ROWS":   4,
		"QUERY_COMMAND_EXEC_RESULT": 5,
		"QUERY_COMMAND_EXEC_LASTID": 6,
		"QUERY_COMMAND_BATCH_EXEC":  7,
		"QUERY_COMMAND_COPY_FROM":   8,
	}
)

Enum value maps for QueryCommand.

View Source
var File_sqld_v1_plugin_annotation_proto protoreflect.FileDescriptor
View Source
var File_sqld_v1_plugin_plugin_proto protoreflect.FileDescriptor
View Source
var Generator_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "sqld.v1.plugin.Generator",
	HandlerType: (*GeneratorServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetInfo",
			Handler:    _Generator_GetInfo_Handler,
		},
		{
			MethodName: "Generate",
			Handler:    _Generator_Generate_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "sqld/v1/plugin/plugin.proto",
}

Generator_ServiceDesc is the grpc.ServiceDesc for Generator service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterGeneratorServer

func RegisterGeneratorServer(s grpc.ServiceRegistrar, srv GeneratorServer)

Types

type AnnotationCardinality

type AnnotationCardinality int32
const (
	AnnotationCardinality_ANNOTATION_CARDINALITY_UNSPECIFIED AnnotationCardinality = 0
	AnnotationCardinality_ANNOTATION_CARDINALITY_SINGLE      AnnotationCardinality = 1 // at most one per target
	AnnotationCardinality_ANNOTATION_CARDINALITY_REPEATED    AnnotationCardinality = 2 // may appear multiple times
)

func (AnnotationCardinality) Descriptor

func (AnnotationCardinality) Enum

func (AnnotationCardinality) EnumDescriptor deprecated

func (AnnotationCardinality) EnumDescriptor() ([]byte, []int)

Deprecated: Use AnnotationCardinality.Descriptor instead.

func (AnnotationCardinality) Number

func (AnnotationCardinality) String

func (x AnnotationCardinality) String() string

func (AnnotationCardinality) Type

type AnnotationDef

type AnnotationDef struct {
	Name        string                    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`       // e.g. "name", "cache"
	Aliases     []string                  `protobuf:"bytes,2,rep,name=aliases,proto3" json:"aliases,omitempty"` // alternate spellings
	Doc         string                    `protobuf:"bytes,3,opt,name=doc,proto3" json:"doc,omitempty"`
	Targets     []ir.AnnotationTargetKind `protobuf:"varint,4,rep,packed,name=targets,proto3,enum=sqld.v1.ir.AnnotationTargetKind" json:"targets,omitempty"` // where it may attach
	Cardinality AnnotationCardinality     `protobuf:"varint,5,opt,name=cardinality,proto3,enum=sqld.v1.plugin.AnnotationCardinality" json:"cardinality,omitempty"`
	Placement   CommentPlacement          `protobuf:"varint,6,opt,name=placement,proto3,enum=sqld.v1.plugin.CommentPlacement" json:"placement,omitempty"`
	Required    bool                      `protobuf:"varint,7,opt,name=required,proto3" json:"required,omitempty"` // must be present on target
	Value       *AnnotationValueSpec      `protobuf:"bytes,8,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

AnnotationDef declares one annotation the plugin understands.

func (*AnnotationDef) Descriptor deprecated

func (*AnnotationDef) Descriptor() ([]byte, []int)

Deprecated: Use AnnotationDef.ProtoReflect.Descriptor instead.

func (*AnnotationDef) GetAliases

func (x *AnnotationDef) GetAliases() []string

func (*AnnotationDef) GetCardinality

func (x *AnnotationDef) GetCardinality() AnnotationCardinality

func (*AnnotationDef) GetDoc

func (x *AnnotationDef) GetDoc() string

func (*AnnotationDef) GetName

func (x *AnnotationDef) GetName() string

func (*AnnotationDef) GetPlacement

func (x *AnnotationDef) GetPlacement() CommentPlacement

func (*AnnotationDef) GetRequired

func (x *AnnotationDef) GetRequired() bool

func (*AnnotationDef) GetTargets

func (x *AnnotationDef) GetTargets() []ir.AnnotationTargetKind

func (*AnnotationDef) GetValue

func (x *AnnotationDef) GetValue() *AnnotationValueSpec

func (*AnnotationDef) ProtoMessage

func (*AnnotationDef) ProtoMessage()

func (*AnnotationDef) ProtoReflect

func (x *AnnotationDef) ProtoReflect() protoreflect.Message

func (*AnnotationDef) Reset

func (x *AnnotationDef) Reset()

func (*AnnotationDef) String

func (x *AnnotationDef) String() string

type AnnotationForm

type AnnotationForm int32

AnnotationForm is the shape of an annotation's value part.

const (
	AnnotationForm_ANNOTATION_FORM_UNSPECIFIED AnnotationForm = 0
	AnnotationForm_ANNOTATION_FORM_FLAG        AnnotationForm = 1 // presence only: `@deprecated`
	AnnotationForm_ANNOTATION_FORM_SCALAR      AnnotationForm = 2 // one typed value: `@name GetUser`, `@ttl 30s`
	AnnotationForm_ANNOTATION_FORM_POSITIONAL  AnnotationForm = 3 // ordered fields: `@fk users id`
	AnnotationForm_ANNOTATION_FORM_KEYED       AnnotationForm = 4 // key=value pairs: `@cache ttl=30s region=eu`
	AnnotationForm_ANNOTATION_FORM_LIST        AnnotationForm = 5 // delimited list: `@index a,b,c`
	AnnotationForm_ANNOTATION_FORM_FREEFORM    AnnotationForm = 6 // remainder captured raw: `@doc any text`
)

func (AnnotationForm) Descriptor

func (AnnotationForm) Enum

func (x AnnotationForm) Enum() *AnnotationForm

func (AnnotationForm) EnumDescriptor deprecated

func (AnnotationForm) EnumDescriptor() ([]byte, []int)

Deprecated: Use AnnotationForm.Descriptor instead.

func (AnnotationForm) Number

func (AnnotationForm) String

func (x AnnotationForm) String() string

func (AnnotationForm) Type

type AnnotationSchema

type AnnotationSchema struct {
	Sigil           string           `protobuf:"bytes,1,opt,name=sigil,proto3" json:"sigil,omitempty"`                                             // marker before the name, e.g. "@"; empty = bare key
	CaseInsensitive bool             `protobuf:"varint,2,opt,name=case_insensitive,json=caseInsensitive,proto3" json:"case_insensitive,omitempty"` // match names ignoring case
	CommentStyles   []string         `protobuf:"bytes,3,rep,name=comment_styles,json=commentStyles,proto3" json:"comment_styles,omitempty"`        // comment syntaxes to scan: "--", "/* */", "#"
	Annotations     []*AnnotationDef `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty"`
	// contains filtered or unexported fields
}

AnnotationSchema is the complete grammar a plugin declares. Returned in GetInfoResponse so the host can parse comments before calling Generate.

func (*AnnotationSchema) Descriptor deprecated

func (*AnnotationSchema) Descriptor() ([]byte, []int)

Deprecated: Use AnnotationSchema.ProtoReflect.Descriptor instead.

func (*AnnotationSchema) GetAnnotations

func (x *AnnotationSchema) GetAnnotations() []*AnnotationDef

func (*AnnotationSchema) GetCaseInsensitive

func (x *AnnotationSchema) GetCaseInsensitive() bool

func (*AnnotationSchema) GetCommentStyles

func (x *AnnotationSchema) GetCommentStyles() []string

func (*AnnotationSchema) GetSigil

func (x *AnnotationSchema) GetSigil() string

func (*AnnotationSchema) ProtoMessage

func (*AnnotationSchema) ProtoMessage()

func (*AnnotationSchema) ProtoReflect

func (x *AnnotationSchema) ProtoReflect() protoreflect.Message

func (*AnnotationSchema) Reset

func (x *AnnotationSchema) Reset()

func (*AnnotationSchema) String

func (x *AnnotationSchema) String() string

type AnnotationValueSpec

type AnnotationValueSpec struct {
	Form AnnotationForm `protobuf:"varint,1,opt,name=form,proto3,enum=sqld.v1.plugin.AnnotationForm" json:"form,omitempty"`
	// POSITIONAL / KEYED: the expected fields. For KEYED, `name` is the key; for
	// POSITIONAL, order matters and `name` labels the produced arg.
	Fields []*FieldSpec `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"`
	// SCALAR: the single value's type.
	ScalarType ir.AnnotationArgType `` /* 126-byte string literal not displayed */
	// LIST: the element type (its `name` is ignored).
	Element *FieldSpec `protobuf:"bytes,4,opt,name=element,proto3" json:"element,omitempty"`
	// Separators (sensible defaults applied by the host when empty).
	ItemSeparator string `protobuf:"bytes,5,opt,name=item_separator,json=itemSeparator,proto3" json:"item_separator,omitempty"` // LIST items; default ","
	PairSeparator string `protobuf:"bytes,6,opt,name=pair_separator,json=pairSeparator,proto3" json:"pair_separator,omitempty"` // KEYED pairs; default whitespace
	KvSeparator   string `protobuf:"bytes,7,opt,name=kv_separator,json=kvSeparator,proto3" json:"kv_separator,omitempty"`       // KEYED key/value; default "="
	// contains filtered or unexported fields
}

AnnotationValueSpec tells the host how to parse the value part of an annotation into sqld.v1.ir.AnnotationArg values.

func (*AnnotationValueSpec) Descriptor deprecated

func (*AnnotationValueSpec) Descriptor() ([]byte, []int)

Deprecated: Use AnnotationValueSpec.ProtoReflect.Descriptor instead.

func (*AnnotationValueSpec) GetElement

func (x *AnnotationValueSpec) GetElement() *FieldSpec

func (*AnnotationValueSpec) GetFields

func (x *AnnotationValueSpec) GetFields() []*FieldSpec

func (*AnnotationValueSpec) GetForm

func (x *AnnotationValueSpec) GetForm() AnnotationForm

func (*AnnotationValueSpec) GetItemSeparator

func (x *AnnotationValueSpec) GetItemSeparator() string

func (*AnnotationValueSpec) GetKvSeparator

func (x *AnnotationValueSpec) GetKvSeparator() string

func (*AnnotationValueSpec) GetPairSeparator

func (x *AnnotationValueSpec) GetPairSeparator() string

func (*AnnotationValueSpec) GetScalarType

func (x *AnnotationValueSpec) GetScalarType() ir.AnnotationArgType

func (*AnnotationValueSpec) ProtoMessage

func (*AnnotationValueSpec) ProtoMessage()

func (*AnnotationValueSpec) ProtoReflect

func (x *AnnotationValueSpec) ProtoReflect() protoreflect.Message

func (*AnnotationValueSpec) Reset

func (x *AnnotationValueSpec) Reset()

func (*AnnotationValueSpec) String

func (x *AnnotationValueSpec) String() string

type CommentPlacement

type CommentPlacement int32

CommentPlacement constrains where the annotation may appear.

const (
	CommentPlacement_COMMENT_PLACEMENT_UNSPECIFIED CommentPlacement = 0
	CommentPlacement_COMMENT_PLACEMENT_LEADING     CommentPlacement = 1 // comment block immediately before object
	CommentPlacement_COMMENT_PLACEMENT_TRAILING    CommentPlacement = 2 // inline/trailing comment (e.g. on a column)
	CommentPlacement_COMMENT_PLACEMENT_COMMENT_ON  CommentPlacement = 3 // inside COMMENT ON ... IS '...'
	CommentPlacement_COMMENT_PLACEMENT_ANY         CommentPlacement = 4
)

func (CommentPlacement) Descriptor

func (CommentPlacement) Enum

func (CommentPlacement) EnumDescriptor deprecated

func (CommentPlacement) EnumDescriptor() ([]byte, []int)

Deprecated: Use CommentPlacement.Descriptor instead.

func (CommentPlacement) Number

func (CommentPlacement) String

func (x CommentPlacement) String() string

func (CommentPlacement) Type

type Diagnostic

type Diagnostic struct {
	Severity DiagnosticSeverity `protobuf:"varint,1,opt,name=severity,proto3,enum=sqld.v1.plugin.DiagnosticSeverity" json:"severity,omitempty"`
	Message  string             `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Source   *ir.SourceSpan     `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` // where it originated, when known
	Code     string             `protobuf:"bytes,4,opt,name=code,proto3" json:"code,omitempty"`     // stable diagnostic code
	// contains filtered or unexported fields
}

func (*Diagnostic) Descriptor deprecated

func (*Diagnostic) Descriptor() ([]byte, []int)

Deprecated: Use Diagnostic.ProtoReflect.Descriptor instead.

func (*Diagnostic) GetCode

func (x *Diagnostic) GetCode() string

func (*Diagnostic) GetMessage

func (x *Diagnostic) GetMessage() string

func (*Diagnostic) GetSeverity

func (x *Diagnostic) GetSeverity() DiagnosticSeverity

func (*Diagnostic) GetSource

func (x *Diagnostic) GetSource() *ir.SourceSpan

func (*Diagnostic) ProtoMessage

func (*Diagnostic) ProtoMessage()

func (*Diagnostic) ProtoReflect

func (x *Diagnostic) ProtoReflect() protoreflect.Message

func (*Diagnostic) Reset

func (x *Diagnostic) Reset()

func (*Diagnostic) String

func (x *Diagnostic) String() string

type DiagnosticSeverity

type DiagnosticSeverity int32
const (
	DiagnosticSeverity_DIAGNOSTIC_SEVERITY_UNSPECIFIED DiagnosticSeverity = 0
	DiagnosticSeverity_DIAGNOSTIC_SEVERITY_INFO        DiagnosticSeverity = 1
	DiagnosticSeverity_DIAGNOSTIC_SEVERITY_WARNING     DiagnosticSeverity = 2
	DiagnosticSeverity_DIAGNOSTIC_SEVERITY_ERROR       DiagnosticSeverity = 3 // a single ERROR fails the run
)

func (DiagnosticSeverity) Descriptor

func (DiagnosticSeverity) Enum

func (DiagnosticSeverity) EnumDescriptor deprecated

func (DiagnosticSeverity) EnumDescriptor() ([]byte, []int)

Deprecated: Use DiagnosticSeverity.Descriptor instead.

func (DiagnosticSeverity) Number

func (DiagnosticSeverity) String

func (x DiagnosticSeverity) String() string

func (DiagnosticSeverity) Type

type FieldSpec

type FieldSpec struct {
	Name       string               `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`                                    // key name / positional label
	Type       ir.AnnotationArgType `protobuf:"varint,2,opt,name=type,proto3,enum=sqld.v1.ir.AnnotationArgType" json:"type,omitempty"` // how to coerce the token
	Required   bool                 `protobuf:"varint,3,opt,name=required,proto3" json:"required,omitempty"`
	EnumValues []string             `protobuf:"bytes,4,rep,name=enum_values,json=enumValues,proto3" json:"enum_values,omitempty"` // allowed values when type == ENUM
	Default    string               `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"`                         // raw default when omitted
	Variadic   bool                 `protobuf:"varint,6,opt,name=variadic,proto3" json:"variadic,omitempty"`                      // last positional captures remainder
	Doc        string               `protobuf:"bytes,7,opt,name=doc,proto3" json:"doc,omitempty"`
	// contains filtered or unexported fields
}

FieldSpec describes one field the host should extract (a positional slot or a named key).

func (*FieldSpec) Descriptor deprecated

func (*FieldSpec) Descriptor() ([]byte, []int)

Deprecated: Use FieldSpec.ProtoReflect.Descriptor instead.

func (*FieldSpec) GetDefault

func (x *FieldSpec) GetDefault() string

func (*FieldSpec) GetDoc

func (x *FieldSpec) GetDoc() string

func (*FieldSpec) GetEnumValues

func (x *FieldSpec) GetEnumValues() []string

func (*FieldSpec) GetName

func (x *FieldSpec) GetName() string

func (*FieldSpec) GetRequired

func (x *FieldSpec) GetRequired() bool

func (*FieldSpec) GetType

func (x *FieldSpec) GetType() ir.AnnotationArgType

func (*FieldSpec) GetVariadic

func (x *FieldSpec) GetVariadic() bool

func (*FieldSpec) ProtoMessage

func (*FieldSpec) ProtoMessage()

func (*FieldSpec) ProtoReflect

func (x *FieldSpec) ProtoReflect() protoreflect.Message

func (*FieldSpec) Reset

func (x *FieldSpec) Reset()

func (*FieldSpec) String

func (x *FieldSpec) String() string

type GenerateRequest

type GenerateRequest struct {

	// Schema IR derived from DDL and applied migrations.
	Catalog *ir.Catalog `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"`
	// Named DML queries parsed from query sources.
	Queries []*Query `protobuf:"bytes,2,rep,name=queries,proto3" json:"queries,omitempty"`
	// Ordered migrations (raw + parsed), for migration-aware generators.
	Migrations []*Migration `protobuf:"bytes,3,rep,name=migrations,proto3" json:"migrations,omitempty"`
	// Plugin-specific settings, opaque to the host. The plugin decodes these
	// bytes into its own options message (see PluginConfig.options).
	Options []byte `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"`
	// Output directory the plugin should target (host resolves/cleans it).
	OutDir  string         `protobuf:"bytes,5,opt,name=out_dir,json=outDir,proto3" json:"out_dir,omitempty"`
	Context *PluginContext `protobuf:"bytes,6,opt,name=context,proto3" json:"context,omitempty"`
	// All annotations parsed from the SQL sources, per the plugin's declared
	// AnnotationSchema. A flat, global list keyed by target; also mirrored onto
	// each object's Metadata.annotations.
	Annotations []*ir.AnnotationValue `protobuf:"bytes,7,rep,name=annotations,proto3" json:"annotations,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateRequest) Descriptor deprecated

func (*GenerateRequest) Descriptor() ([]byte, []int)

Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead.

func (*GenerateRequest) GetAnnotations

func (x *GenerateRequest) GetAnnotations() []*ir.AnnotationValue

func (*GenerateRequest) GetCatalog

func (x *GenerateRequest) GetCatalog() *ir.Catalog

func (*GenerateRequest) GetContext

func (x *GenerateRequest) GetContext() *PluginContext

func (*GenerateRequest) GetMigrations

func (x *GenerateRequest) GetMigrations() []*Migration

func (*GenerateRequest) GetOptions

func (x *GenerateRequest) GetOptions() []byte

func (*GenerateRequest) GetOutDir

func (x *GenerateRequest) GetOutDir() string

func (*GenerateRequest) GetQueries

func (x *GenerateRequest) GetQueries() []*Query

func (*GenerateRequest) ProtoMessage

func (*GenerateRequest) ProtoMessage()

func (*GenerateRequest) ProtoReflect

func (x *GenerateRequest) ProtoReflect() protoreflect.Message

func (*GenerateRequest) Reset

func (x *GenerateRequest) Reset()

func (*GenerateRequest) String

func (x *GenerateRequest) String() string

type GenerateResponse

type GenerateResponse struct {
	Files       []*GeneratedFile `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
	Diagnostics []*Diagnostic    `protobuf:"bytes,2,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateResponse) Descriptor deprecated

func (*GenerateResponse) Descriptor() ([]byte, []int)

Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead.

func (*GenerateResponse) GetDiagnostics

func (x *GenerateResponse) GetDiagnostics() []*Diagnostic

func (*GenerateResponse) GetFiles

func (x *GenerateResponse) GetFiles() []*GeneratedFile

func (*GenerateResponse) ProtoMessage

func (*GenerateResponse) ProtoMessage()

func (*GenerateResponse) ProtoReflect

func (x *GenerateResponse) ProtoReflect() protoreflect.Message

func (*GenerateResponse) Reset

func (x *GenerateResponse) Reset()

func (*GenerateResponse) String

func (x *GenerateResponse) String() string

type GeneratedFile

type GeneratedFile struct {
	Path       string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` // relative to GenerateRequest.out_dir
	Contents   []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"`
	Executable bool   `protobuf:"varint,3,opt,name=executable,proto3" json:"executable,omitempty"` // set the executable bit
	// contains filtered or unexported fields
}

func (*GeneratedFile) Descriptor deprecated

func (*GeneratedFile) Descriptor() ([]byte, []int)

Deprecated: Use GeneratedFile.ProtoReflect.Descriptor instead.

func (*GeneratedFile) GetContents

func (x *GeneratedFile) GetContents() []byte

func (*GeneratedFile) GetExecutable

func (x *GeneratedFile) GetExecutable() bool

func (*GeneratedFile) GetPath

func (x *GeneratedFile) GetPath() string

func (*GeneratedFile) ProtoMessage

func (*GeneratedFile) ProtoMessage()

func (*GeneratedFile) ProtoReflect

func (x *GeneratedFile) ProtoReflect() protoreflect.Message

func (*GeneratedFile) Reset

func (x *GeneratedFile) Reset()

func (*GeneratedFile) String

func (x *GeneratedFile) String() string

type GeneratorClient

type GeneratorClient interface {
	// GetInfo reports plugin identity and capabilities so the host can validate
	// it before running. Cheap; no IR is sent.
	GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error)
	// Generate turns the IR (schema + queries + migrations) into output files.
	Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error)
}

GeneratorClient is the client API for Generator service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewGeneratorClient

func NewGeneratorClient(cc grpc.ClientConnInterface) GeneratorClient

type GeneratorServer

type GeneratorServer interface {
	// GetInfo reports plugin identity and capabilities so the host can validate
	// it before running. Cheap; no IR is sent.
	GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error)
	// Generate turns the IR (schema + queries + migrations) into output files.
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error)
	// contains filtered or unexported methods
}

GeneratorServer is the server API for Generator service. All implementations must embed UnimplementedGeneratorServer for forward compatibility.

type GetInfoRequest

type GetInfoRequest struct {
	// contains filtered or unexported fields
}

func (*GetInfoRequest) Descriptor deprecated

func (*GetInfoRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetInfoRequest.ProtoReflect.Descriptor instead.

func (*GetInfoRequest) ProtoMessage

func (*GetInfoRequest) ProtoMessage()

func (*GetInfoRequest) ProtoReflect

func (x *GetInfoRequest) ProtoReflect() protoreflect.Message

func (*GetInfoRequest) Reset

func (x *GetInfoRequest) Reset()

func (*GetInfoRequest) String

func (x *GetInfoRequest) String() string

type GetInfoResponse

type GetInfoResponse struct {
	Name             string      `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version          string      `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	SupportedEngines []ir.Engine `` /* 140-byte string literal not displayed */
	// Human/tooling-readable description of accepted options (e.g. a JSON schema
	// or a proto descriptor name). Informational; options on the wire are bytes.
	OptionsSchema string   `protobuf:"bytes,4,opt,name=options_schema,json=optionsSchema,proto3" json:"options_schema,omitempty"`
	Capabilities  []string `protobuf:"bytes,5,rep,name=capabilities,proto3" json:"capabilities,omitempty"` // free-form feature flags
	// Grammar of the SQL-comment annotations this plugin understands. The host
	// parses comments against this and returns sqld.v1.ir.AnnotationValue results.
	AnnotationSchema *AnnotationSchema `protobuf:"bytes,6,opt,name=annotation_schema,json=annotationSchema,proto3" json:"annotation_schema,omitempty"`
	// contains filtered or unexported fields
}

func (*GetInfoResponse) Descriptor deprecated

func (*GetInfoResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetInfoResponse.ProtoReflect.Descriptor instead.

func (*GetInfoResponse) GetAnnotationSchema

func (x *GetInfoResponse) GetAnnotationSchema() *AnnotationSchema

func (*GetInfoResponse) GetCapabilities

func (x *GetInfoResponse) GetCapabilities() []string

func (*GetInfoResponse) GetName

func (x *GetInfoResponse) GetName() string

func (*GetInfoResponse) GetOptionsSchema

func (x *GetInfoResponse) GetOptionsSchema() string

func (*GetInfoResponse) GetSupportedEngines

func (x *GetInfoResponse) GetSupportedEngines() []ir.Engine

func (*GetInfoResponse) GetVersion

func (x *GetInfoResponse) GetVersion() string

func (*GetInfoResponse) ProtoMessage

func (*GetInfoResponse) ProtoMessage()

func (*GetInfoResponse) ProtoReflect

func (x *GetInfoResponse) ProtoReflect() protoreflect.Message

func (*GetInfoResponse) Reset

func (x *GetInfoResponse) Reset()

func (*GetInfoResponse) String

func (x *GetInfoResponse) String() string

type Migration

type Migration struct {
	Version    string          `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // ordering key: "0001", timestamp, ...
	Name       string          `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	UpSql      string          `protobuf:"bytes,3,opt,name=up_sql,json=upSql,proto3" json:"up_sql,omitempty"`
	DownSql    string          `protobuf:"bytes,4,opt,name=down_sql,json=downSql,proto3" json:"down_sql,omitempty"`
	Up         []*ir.Statement `protobuf:"bytes,5,rep,name=up,proto3" json:"up,omitempty"`     // parsed up statements
	Down       []*ir.Statement `protobuf:"bytes,6,rep,name=down,proto3" json:"down,omitempty"` // parsed down statements
	SourceFile string          `protobuf:"bytes,7,opt,name=source_file,json=sourceFile,proto3" json:"source_file,omitempty"`
	// contains filtered or unexported fields
}

Migration is one ordered migration step, raw and parsed.

func (*Migration) Descriptor deprecated

func (*Migration) Descriptor() ([]byte, []int)

Deprecated: Use Migration.ProtoReflect.Descriptor instead.

func (*Migration) GetDown

func (x *Migration) GetDown() []*ir.Statement

func (*Migration) GetDownSql

func (x *Migration) GetDownSql() string

func (*Migration) GetName

func (x *Migration) GetName() string

func (*Migration) GetSourceFile

func (x *Migration) GetSourceFile() string

func (*Migration) GetUp

func (x *Migration) GetUp() []*ir.Statement

func (*Migration) GetUpSql

func (x *Migration) GetUpSql() string

func (*Migration) GetVersion

func (x *Migration) GetVersion() string

func (*Migration) ProtoMessage

func (*Migration) ProtoMessage()

func (*Migration) ProtoReflect

func (x *Migration) ProtoReflect() protoreflect.Message

func (*Migration) Reset

func (x *Migration) Reset()

func (*Migration) String

func (x *Migration) String() string

type PluginContext

type PluginContext struct {
	HostVersion string            `protobuf:"bytes,1,opt,name=host_version,json=hostVersion,proto3" json:"host_version,omitempty"`
	WorkingDir  string            `protobuf:"bytes,2,opt,name=working_dir,json=workingDir,proto3" json:"working_dir,omitempty"`
	Engine      ir.Engine         `protobuf:"varint,3,opt,name=engine,proto3,enum=sqld.v1.ir.Engine" json:"engine,omitempty"`
	Env         map[string]string `` /* 133-byte string literal not displayed */
	// contains filtered or unexported fields
}

PluginContext carries host-side run information.

func (*PluginContext) Descriptor deprecated

func (*PluginContext) Descriptor() ([]byte, []int)

Deprecated: Use PluginContext.ProtoReflect.Descriptor instead.

func (*PluginContext) GetEngine

func (x *PluginContext) GetEngine() ir.Engine

func (*PluginContext) GetEnv

func (x *PluginContext) GetEnv() map[string]string

func (*PluginContext) GetHostVersion

func (x *PluginContext) GetHostVersion() string

func (*PluginContext) GetWorkingDir

func (x *PluginContext) GetWorkingDir() string

func (*PluginContext) ProtoMessage

func (*PluginContext) ProtoMessage()

func (*PluginContext) ProtoReflect

func (x *PluginContext) ProtoReflect() protoreflect.Message

func (*PluginContext) Reset

func (x *PluginContext) Reset()

func (*PluginContext) String

func (x *PluginContext) String() string

type Query

type Query struct {
	Name       string            `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // from `-- name: Foo :one`
	Sql        string            `protobuf:"bytes,2,opt,name=sql,proto3" json:"sql,omitempty"`   // raw SQL text
	Command    QueryCommand      `protobuf:"varint,3,opt,name=command,proto3,enum=sqld.v1.plugin.QueryCommand" json:"command,omitempty"`
	Ast        *ir.Statement     `protobuf:"bytes,4,opt,name=ast,proto3" json:"ast,omitempty"` // parsed statement IR
	Parameters []*QueryParameter `protobuf:"bytes,5,rep,name=parameters,proto3" json:"parameters,omitempty"`
	Columns    []*QueryColumn    `protobuf:"bytes,6,rep,name=columns,proto3" json:"columns,omitempty"`
	SourceFile string            `protobuf:"bytes,7,opt,name=source_file,json=sourceFile,proto3" json:"source_file,omitempty"`
	Comment    string            `protobuf:"bytes,8,opt,name=comment,proto3" json:"comment,omitempty"` // leading doc comment, if any
	// contains filtered or unexported fields
}

Query is a named DML query plus its inferred signature.

func (*Query) Descriptor deprecated

func (*Query) Descriptor() ([]byte, []int)

Deprecated: Use Query.ProtoReflect.Descriptor instead.

func (*Query) GetAst

func (x *Query) GetAst() *ir.Statement

func (*Query) GetColumns

func (x *Query) GetColumns() []*QueryColumn

func (*Query) GetCommand

func (x *Query) GetCommand() QueryCommand

func (*Query) GetComment

func (x *Query) GetComment() string

func (*Query) GetName

func (x *Query) GetName() string

func (*Query) GetParameters

func (x *Query) GetParameters() []*QueryParameter

func (*Query) GetSourceFile

func (x *Query) GetSourceFile() string

func (*Query) GetSql

func (x *Query) GetSql() string

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) ProtoReflect

func (x *Query) ProtoReflect() protoreflect.Message

func (*Query) Reset

func (x *Query) Reset()

func (*Query) String

func (x *Query) String() string

type QueryColumn

type QueryColumn struct {
	Name         string        `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type         *ir.TypeRef   `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Nullable     bool          `protobuf:"varint,3,opt,name=nullable,proto3" json:"nullable,omitempty"`
	IsArray      bool          `protobuf:"varint,4,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"`
	SourceColumn *ir.ObjectRef `protobuf:"bytes,5,opt,name=source_column,json=sourceColumn,proto3" json:"source_column,omitempty"` // origin column, when inferred
	TableAlias   string        `protobuf:"bytes,6,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"`
	// contains filtered or unexported fields
}

QueryColumn is an inferred output column of a query.

func (*QueryColumn) Descriptor deprecated

func (*QueryColumn) Descriptor() ([]byte, []int)

Deprecated: Use QueryColumn.ProtoReflect.Descriptor instead.

func (*QueryColumn) GetIsArray

func (x *QueryColumn) GetIsArray() bool

func (*QueryColumn) GetName

func (x *QueryColumn) GetName() string

func (*QueryColumn) GetNullable

func (x *QueryColumn) GetNullable() bool

func (*QueryColumn) GetSourceColumn

func (x *QueryColumn) GetSourceColumn() *ir.ObjectRef

func (*QueryColumn) GetTableAlias

func (x *QueryColumn) GetTableAlias() string

func (*QueryColumn) GetType

func (x *QueryColumn) GetType() *ir.TypeRef

func (*QueryColumn) ProtoMessage

func (*QueryColumn) ProtoMessage()

func (*QueryColumn) ProtoReflect

func (x *QueryColumn) ProtoReflect() protoreflect.Message

func (*QueryColumn) Reset

func (x *QueryColumn) Reset()

func (*QueryColumn) String

func (x *QueryColumn) String() string

type QueryCommand

type QueryCommand int32

QueryCommand is the result-shape annotation (sqlc-style `:one`, `:many`...).

const (
	QueryCommand_QUERY_COMMAND_UNSPECIFIED QueryCommand = 0
	QueryCommand_QUERY_COMMAND_ONE         QueryCommand = 1 // :one
	QueryCommand_QUERY_COMMAND_MANY        QueryCommand = 2 // :many
	QueryCommand_QUERY_COMMAND_EXEC        QueryCommand = 3 // :exec
	QueryCommand_QUERY_COMMAND_EXEC_ROWS   QueryCommand = 4 // :execrows (affected row count)
	QueryCommand_QUERY_COMMAND_EXEC_RESULT QueryCommand = 5 // :execresult
	QueryCommand_QUERY_COMMAND_EXEC_LASTID QueryCommand = 6 // :execlastid
	QueryCommand_QUERY_COMMAND_BATCH_EXEC  QueryCommand = 7 // :batchexec
	QueryCommand_QUERY_COMMAND_COPY_FROM   QueryCommand = 8 // :copyfrom
)

func (QueryCommand) Descriptor

func (QueryCommand) Enum

func (x QueryCommand) Enum() *QueryCommand

func (QueryCommand) EnumDescriptor deprecated

func (QueryCommand) EnumDescriptor() ([]byte, []int)

Deprecated: Use QueryCommand.Descriptor instead.

func (QueryCommand) Number

func (QueryCommand) String

func (x QueryCommand) String() string

func (QueryCommand) Type

type QueryParameter

type QueryParameter struct {
	Number   uint32        `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` // 1-based position
	Name     string        `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`      // named param, when available
	Type     *ir.TypeRef   `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	Nullable bool          `protobuf:"varint,4,opt,name=nullable,proto3" json:"nullable,omitempty"`
	Column   *ir.ObjectRef `protobuf:"bytes,5,opt,name=column,proto3" json:"column,omitempty"` // originating column, when inferred
	// optional marks a dynamic-query parameter declared with the `@name?` suffix:
	// the WHERE condition using it is included only when the caller supplies it.
	Optional bool `protobuf:"varint,6,opt,name=optional,proto3" json:"optional,omitempty"`
	// contains filtered or unexported fields
}

QueryParameter is an inferred bind parameter ($1, $2, ...).

func (*QueryParameter) Descriptor deprecated

func (*QueryParameter) Descriptor() ([]byte, []int)

Deprecated: Use QueryParameter.ProtoReflect.Descriptor instead.

func (*QueryParameter) GetColumn

func (x *QueryParameter) GetColumn() *ir.ObjectRef

func (*QueryParameter) GetName

func (x *QueryParameter) GetName() string

func (*QueryParameter) GetNullable

func (x *QueryParameter) GetNullable() bool

func (*QueryParameter) GetNumber

func (x *QueryParameter) GetNumber() uint32

func (*QueryParameter) GetOptional

func (x *QueryParameter) GetOptional() bool

func (*QueryParameter) GetType

func (x *QueryParameter) GetType() *ir.TypeRef

func (*QueryParameter) ProtoMessage

func (*QueryParameter) ProtoMessage()

func (*QueryParameter) ProtoReflect

func (x *QueryParameter) ProtoReflect() protoreflect.Message

func (*QueryParameter) Reset

func (x *QueryParameter) Reset()

func (*QueryParameter) String

func (x *QueryParameter) String() string

type UnimplementedGeneratorServer

type UnimplementedGeneratorServer struct{}

UnimplementedGeneratorServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedGeneratorServer) Generate

func (UnimplementedGeneratorServer) GetInfo

type UnsafeGeneratorServer

type UnsafeGeneratorServer interface {
	// contains filtered or unexported methods
}

UnsafeGeneratorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GeneratorServer will result in compilation errors.

Jump to

Keyboard shortcuts

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