diff --git a/internal/analysis/analysis.pb.go b/internal/analysis/analysis.pb.go index e039cd6162..6c43063429 100644 --- a/internal/analysis/analysis.pb.go +++ b/internal/analysis/analysis.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: analysis/analysis.proto @@ -21,22 +21,19 @@ const ( ) type Identifier struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` + Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields - - Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` - Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Identifier) Reset() { *x = Identifier{} - if protoimpl.UnsafeEnabled { - mi := &file_analysis_analysis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_analysis_analysis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Identifier) String() string { @@ -47,7 +44,7 @@ func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { mi := &file_analysis_analysis_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -83,37 +80,95 @@ func (x *Identifier) GetName() string { return "" } -type Column struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache +type SqlcSortOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + IsOrder bool `protobuf:"varint,1,opt,name=is_order,json=isOrder,proto3" json:"is_order,omitempty"` + DefaultField string `protobuf:"bytes,2,opt,name=default_field,json=defaultField,proto3" json:"default_field,omitempty"` + DefaultOrder string `protobuf:"bytes,3,opt,name=default_order,json=defaultOrder,proto3" json:"default_order,omitempty"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - OriginalName string `protobuf:"bytes,2,opt,name=original_name,json=originalName,proto3" json:"original_name,omitempty"` - DataType string `protobuf:"bytes,3,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` - NotNull bool `protobuf:"varint,4,opt,name=not_null,json=notNull,proto3" json:"not_null,omitempty"` - Unsigned bool `protobuf:"varint,5,opt,name=unsigned,proto3" json:"unsigned,omitempty"` - IsArray bool `protobuf:"varint,6,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"` - ArrayDims int32 `protobuf:"varint,7,opt,name=array_dims,json=arrayDims,proto3" json:"array_dims,omitempty"` - Comment string `protobuf:"bytes,8,opt,name=comment,proto3" json:"comment,omitempty"` - Length int32 `protobuf:"varint,9,opt,name=length,proto3" json:"length,omitempty"` // *int - IsNamedParam bool `protobuf:"varint,10,opt,name=is_named_param,json=isNamedParam,proto3" json:"is_named_param,omitempty"` - IsFuncCall bool `protobuf:"varint,11,opt,name=is_func_call,json=isFuncCall,proto3" json:"is_func_call,omitempty"` - Scope string `protobuf:"bytes,12,opt,name=scope,proto3" json:"scope,omitempty"` - Table *Identifier `protobuf:"bytes,13,opt,name=table,proto3" json:"table,omitempty"` - TableAlias string `protobuf:"bytes,14,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"` - Type *Identifier `protobuf:"bytes,15,opt,name=type,proto3" json:"type,omitempty"` - EmbedTable *Identifier `protobuf:"bytes,16,opt,name=embed_table,json=embedTable,proto3" json:"embed_table,omitempty"` - IsSqlcSlice bool `protobuf:"varint,17,opt,name=is_sqlc_slice,json=isSqlcSlice,proto3" json:"is_sqlc_slice,omitempty"` +func (x *SqlcSortOpts) Reset() { + *x = SqlcSortOpts{} + mi := &file_analysis_analysis_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *Column) Reset() { - *x = Column{} - if protoimpl.UnsafeEnabled { - mi := &file_analysis_analysis_proto_msgTypes[1] +func (x *SqlcSortOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SqlcSortOpts) ProtoMessage() {} + +func (x *SqlcSortOpts) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[1] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SqlcSortOpts.ProtoReflect.Descriptor instead. +func (*SqlcSortOpts) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{1} +} + +func (x *SqlcSortOpts) GetIsOrder() bool { + if x != nil { + return x.IsOrder + } + return false +} + +func (x *SqlcSortOpts) GetDefaultField() string { + if x != nil { + return x.DefaultField } + return "" +} + +func (x *SqlcSortOpts) GetDefaultOrder() string { + if x != nil { + return x.DefaultOrder + } + return "" +} + +type Column struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + OriginalName string `protobuf:"bytes,2,opt,name=original_name,json=originalName,proto3" json:"original_name,omitempty"` + DataType string `protobuf:"bytes,3,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` + NotNull bool `protobuf:"varint,4,opt,name=not_null,json=notNull,proto3" json:"not_null,omitempty"` + Unsigned bool `protobuf:"varint,5,opt,name=unsigned,proto3" json:"unsigned,omitempty"` + IsArray bool `protobuf:"varint,6,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"` + ArrayDims int32 `protobuf:"varint,7,opt,name=array_dims,json=arrayDims,proto3" json:"array_dims,omitempty"` + Comment string `protobuf:"bytes,8,opt,name=comment,proto3" json:"comment,omitempty"` + Length int32 `protobuf:"varint,9,opt,name=length,proto3" json:"length,omitempty"` // *int + IsNamedParam bool `protobuf:"varint,10,opt,name=is_named_param,json=isNamedParam,proto3" json:"is_named_param,omitempty"` + IsFuncCall bool `protobuf:"varint,11,opt,name=is_func_call,json=isFuncCall,proto3" json:"is_func_call,omitempty"` + Scope string `protobuf:"bytes,12,opt,name=scope,proto3" json:"scope,omitempty"` + Table *Identifier `protobuf:"bytes,13,opt,name=table,proto3" json:"table,omitempty"` + TableAlias string `protobuf:"bytes,14,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"` + Type *Identifier `protobuf:"bytes,15,opt,name=type,proto3" json:"type,omitempty"` + EmbedTable *Identifier `protobuf:"bytes,16,opt,name=embed_table,json=embedTable,proto3" json:"embed_table,omitempty"` + IsSqlcSlice bool `protobuf:"varint,17,opt,name=is_sqlc_slice,json=isSqlcSlice,proto3" json:"is_sqlc_slice,omitempty"` + SqlcSortOpts *SqlcSortOpts `protobuf:"bytes,18,opt,name=sqlc_sort_opts,json=sqlcSortOpts,proto3,oneof" json:"sqlc_sort_opts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Column) Reset() { + *x = Column{} + mi := &file_analysis_analysis_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Column) String() string { @@ -123,8 +178,8 @@ func (x *Column) String() string { func (*Column) ProtoMessage() {} func (x *Column) ProtoReflect() protoreflect.Message { - mi := &file_analysis_analysis_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_analysis_analysis_proto_msgTypes[2] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -136,7 +191,7 @@ func (x *Column) ProtoReflect() protoreflect.Message { // Deprecated: Use Column.ProtoReflect.Descriptor instead. func (*Column) Descriptor() ([]byte, []int) { - return file_analysis_analysis_proto_rawDescGZIP(), []int{1} + return file_analysis_analysis_proto_rawDescGZIP(), []int{2} } func (x *Column) GetName() string { @@ -258,22 +313,26 @@ func (x *Column) GetIsSqlcSlice() bool { return false } +func (x *Column) GetSqlcSortOpts() *SqlcSortOpts { + if x != nil { + return x.SqlcSortOpts + } + return nil +} + type Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + Column *Column `protobuf:"bytes,2,opt,name=column,proto3" json:"column,omitempty"` unknownFields protoimpl.UnknownFields - - Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` - Column *Column `protobuf:"bytes,2,opt,name=column,proto3" json:"column,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Parameter) Reset() { *x = Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_analysis_analysis_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_analysis_analysis_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Parameter) String() string { @@ -283,8 +342,8 @@ func (x *Parameter) String() string { func (*Parameter) ProtoMessage() {} func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_analysis_analysis_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_analysis_analysis_proto_msgTypes[3] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -296,7 +355,7 @@ func (x *Parameter) ProtoReflect() protoreflect.Message { // Deprecated: Use Parameter.ProtoReflect.Descriptor instead. func (*Parameter) Descriptor() ([]byte, []int) { - return file_analysis_analysis_proto_rawDescGZIP(), []int{2} + return file_analysis_analysis_proto_rawDescGZIP(), []int{3} } func (x *Parameter) GetNumber() int32 { @@ -314,21 +373,18 @@ func (x *Parameter) GetColumn() *Column { } type Analysis struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Columns []*Column `protobuf:"bytes,1,rep,name=columns,proto3" json:"columns,omitempty"` + Params []*Parameter `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` unknownFields protoimpl.UnknownFields - - Columns []*Column `protobuf:"bytes,1,rep,name=columns,proto3" json:"columns,omitempty"` - Params []*Parameter `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Analysis) Reset() { *x = Analysis{} - if protoimpl.UnsafeEnabled { - mi := &file_analysis_analysis_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_analysis_analysis_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Analysis) String() string { @@ -338,8 +394,8 @@ func (x *Analysis) String() string { func (*Analysis) ProtoMessage() {} func (x *Analysis) ProtoReflect() protoreflect.Message { - mi := &file_analysis_analysis_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_analysis_analysis_proto_msgTypes[4] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -351,7 +407,7 @@ func (x *Analysis) ProtoReflect() protoreflect.Message { // Deprecated: Use Analysis.ProtoReflect.Descriptor instead. func (*Analysis) Descriptor() ([]byte, []int) { - return file_analysis_analysis_proto_rawDescGZIP(), []int{3} + return file_analysis_analysis_proto_rawDescGZIP(), []int{4} } func (x *Analysis) GetColumns() []*Column { @@ -378,63 +434,75 @@ var file_analysis_analysis_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xb1, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, - 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, - 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, - 0x75, 0x6c, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, - 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, - 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, - 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, - 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, - 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, - 0x73, 0x69, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, - 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, - 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x35, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, - 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, - 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, - 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, - 0x6c, 0x63, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x69, 0x73, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x22, 0x4d, 0x0a, 0x09, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x12, 0x28, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0x63, 0x0a, 0x08, 0x41, 0x6e, - 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, - 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, - 0x89, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, - 0x42, 0x0d, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, - 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xa2, 0x02, 0x03, - 0x41, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xca, 0x02, - 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xe2, 0x02, 0x14, 0x41, 0x6e, 0x61, 0x6c, - 0x79, 0x73, 0x69, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x73, 0x0a, 0x0c, 0x53, 0x71, 0x6c, 0x63, 0x53, + 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x87, 0x05, 0x0a, + 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, + 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, + 0x67, 0x6e, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, + 0x67, 0x6e, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, + 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x12, 0x18, + 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, + 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, + 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, + 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x2a, + 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, + 0x79, 0x73, 0x69, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x5f, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, + 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, + 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, + 0x12, 0x41, 0x0a, 0x0e, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x70, + 0x74, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x73, 0x69, 0x73, 0x2e, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x73, + 0x48, 0x00, 0x52, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x53, 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x73, + 0x88, 0x01, 0x01, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, 0x6f, 0x72, + 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x4d, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x06, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x6e, + 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0x63, 0x0a, 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, + 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2b, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x89, 0x01, 0x0a, 0x0c, 0x63, + 0x6f, 0x6d, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x42, 0x0d, 0x41, 0x6e, 0x61, + 0x6c, 0x79, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, + 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xca, 0x02, 0x08, 0x41, 0x6e, 0x61, 0x6c, + 0x79, 0x73, 0x69, 0x73, 0xe2, 0x02, 0x14, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08, 0x41, 0x6e, + 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -449,25 +517,27 @@ func file_analysis_analysis_proto_rawDescGZIP() []byte { return file_analysis_analysis_proto_rawDescData } -var file_analysis_analysis_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_analysis_analysis_proto_goTypes = []interface{}{ - (*Identifier)(nil), // 0: analysis.Identifier - (*Column)(nil), // 1: analysis.Column - (*Parameter)(nil), // 2: analysis.Parameter - (*Analysis)(nil), // 3: analysis.Analysis +var file_analysis_analysis_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_analysis_analysis_proto_goTypes = []any{ + (*Identifier)(nil), // 0: analysis.Identifier + (*SqlcSortOpts)(nil), // 1: analysis.SqlcSortOpts + (*Column)(nil), // 2: analysis.Column + (*Parameter)(nil), // 3: analysis.Parameter + (*Analysis)(nil), // 4: analysis.Analysis } var file_analysis_analysis_proto_depIdxs = []int32{ 0, // 0: analysis.Column.table:type_name -> analysis.Identifier 0, // 1: analysis.Column.type:type_name -> analysis.Identifier 0, // 2: analysis.Column.embed_table:type_name -> analysis.Identifier - 1, // 3: analysis.Parameter.column:type_name -> analysis.Column - 1, // 4: analysis.Analysis.columns:type_name -> analysis.Column - 2, // 5: analysis.Analysis.params:type_name -> analysis.Parameter - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 1, // 3: analysis.Column.sqlc_sort_opts:type_name -> analysis.SqlcSortOpts + 2, // 4: analysis.Parameter.column:type_name -> analysis.Column + 2, // 5: analysis.Analysis.columns:type_name -> analysis.Column + 3, // 6: analysis.Analysis.params:type_name -> analysis.Parameter + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_analysis_analysis_proto_init() } @@ -475,63 +545,14 @@ func file_analysis_analysis_proto_init() { if File_analysis_analysis_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_analysis_analysis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_analysis_analysis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Column); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_analysis_analysis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_analysis_analysis_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Analysis); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } + file_analysis_analysis_proto_msgTypes[2].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_analysis_analysis_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index 654500429a..a640f11799 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -67,16 +67,20 @@ func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { for _, typ := range s.Types { switch typ := typ.(type) { case *catalog.Enum: - enums = append(enums, &plugin.Enum{ - Name: typ.Name, - Comment: typ.Comment, - Vals: typ.Vals, - }) + enums = append( + enums, &plugin.Enum{ + Name: typ.Name, + Comment: typ.Comment, + Vals: typ.Vals, + }, + ) case *catalog.CompositeType: - cts = append(cts, &plugin.CompositeType{ - Name: typ.Name, - Comment: typ.Comment, - }) + cts = append( + cts, &plugin.CompositeType{ + Name: typ.Name, + Comment: typ.Comment, + }, + ) } } var tables []*plugin.Table @@ -87,43 +91,49 @@ func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { if c.Length != nil { l = *c.Length } - columns = append(columns, &plugin.Column{ - Name: c.Name, - Type: &plugin.Identifier{ - Catalog: c.Type.Catalog, - Schema: c.Type.Schema, - Name: c.Type.Name, + columns = append( + columns, &plugin.Column{ + Name: c.Name, + Type: &plugin.Identifier{ + Catalog: c.Type.Catalog, + Schema: c.Type.Schema, + Name: c.Type.Name, + }, + Comment: c.Comment, + NotNull: c.IsNotNull, + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: int32(c.ArrayDims), + Length: int32(l), + Table: &plugin.Identifier{ + Catalog: t.Rel.Catalog, + Schema: t.Rel.Schema, + Name: t.Rel.Name, + }, }, - Comment: c.Comment, - NotNull: c.IsNotNull, - Unsigned: c.IsUnsigned, - IsArray: c.IsArray, - ArrayDims: int32(c.ArrayDims), - Length: int32(l), - Table: &plugin.Identifier{ + ) + } + tables = append( + tables, &plugin.Table{ + Rel: &plugin.Identifier{ Catalog: t.Rel.Catalog, Schema: t.Rel.Schema, Name: t.Rel.Name, }, - }) - } - tables = append(tables, &plugin.Table{ - Rel: &plugin.Identifier{ - Catalog: t.Rel.Catalog, - Schema: t.Rel.Schema, - Name: t.Rel.Name, + Columns: columns, + Comment: t.Comment, }, - Columns: columns, - Comment: t.Comment, - }) + ) } - schemas = append(schemas, &plugin.Schema{ - Comment: s.Comment, - Name: s.Name, - Tables: tables, - Enums: enums, - CompositeTypes: cts, - }) + schemas = append( + schemas, &plugin.Schema{ + Comment: s.Comment, + Name: s.Name, + Tables: tables, + Enums: enums, + CompositeTypes: cts, + }, + ) } return &plugin.Catalog{ Name: c.Name, @@ -152,16 +162,18 @@ func pluginQueries(r *compiler.Result) []*plugin.Query { Name: q.InsertIntoTable.Name, } } - out = append(out, &plugin.Query{ - Name: q.Metadata.Name, - Cmd: q.Metadata.Cmd, - Text: q.SQL, - Comments: q.Metadata.Comments, - Columns: columns, - Params: params, - Filename: q.Metadata.Filename, - InsertIntoTable: iit, - }) + out = append( + out, &plugin.Query{ + Name: q.Metadata.Name, + Cmd: q.Metadata.Cmd, + Text: q.SQL, + Comments: q.Metadata.Comments, + Columns: columns, + Params: params, + Filename: q.Metadata.Filename, + InsertIntoTable: iit, + }, + ) } return out } @@ -184,6 +196,13 @@ func pluginQueryColumn(c *compiler.Column) *plugin.Column { IsFuncCall: c.IsFuncCall, IsSqlcSlice: c.IsSqlcSlice, } + if c.SqlcSortOpts != nil { + out.SqlcSortOpts = &plugin.SqlcSortOpts{ + IsOrder: c.SqlcSortOpts.IsOrder, + DefaultField: c.SqlcSortOpts.DefaultField, + DefaultOrder: c.SqlcSortOpts.DefaultOrder, + } + } if c.Type != nil { out.Type = &plugin.Identifier{ diff --git a/internal/codegen/golang/field.go b/internal/codegen/golang/field.go index 2a63b6d342..d51d7cdc50 100644 --- a/internal/codegen/golang/field.go +++ b/internal/codegen/golang/field.go @@ -29,6 +29,18 @@ func (gf Field) HasSqlcSlice() bool { return gf.Column.IsSqlcSlice } +func (gf Field) HasSqlcSort() bool { + return gf.Column.SqlcSortOpts != nil +} + +func (gf Field) NotNull() bool { + return gf.Column.NotNull +} + +func (gf Field) SqlcSortOpts() *plugin.SqlcSortOpts { + return gf.Column.SqlcSortOpts +} + func TagsToString(tags map[string]string) string { if len(tags) == 0 { return "" @@ -81,9 +93,11 @@ var camelPattern = regexp.MustCompile("[^A-Z][A-Z]+") func toSnakeCase(s string) string { if !strings.ContainsRune(s, '_') { - s = camelPattern.ReplaceAllStringFunc(s, func(x string) string { - return x[:1] + "_" + x[1:] - }) + s = camelPattern.ReplaceAllStringFunc( + s, func(x string) string { + return x[:1] + "_" + x[1:] + }, + ) } return strings.ToLower(s) } diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index ccca4f603c..820f9a5007 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -160,7 +160,10 @@ var pqtypeTypes = map[string]struct{}{ "pqtype.NullRawMessage": {}, } -func buildImports(options *opts.Options, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { +func buildImports(options *opts.Options, queries []Query, uses func(string) bool) ( + map[string]struct{}, + map[ImportSpec]struct{}, +) { pkg := make(map[ImportSpec]struct{}) std := make(map[string]struct{}) @@ -247,24 +250,26 @@ func buildImports(options *opts.Options, queries []Query, uses func(string) bool } func (i *importer) interfaceImports() fileImports { - std, pkg := buildImports(i.Options, i.Queries, func(name string) bool { - for _, q := range i.Queries { - if q.hasRetType() { - if usesBatch([]Query{q}) { - continue - } - if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { - return true + std, pkg := buildImports( + i.Options, i.Queries, func(name string) bool { + for _, q := range i.Queries { + if q.hasRetType() { + if usesBatch([]Query{q}) { + continue + } + if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { + return true + } } - } - for _, f := range q.Arg.Pairs() { - if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { - return true + for _, f := range q.Arg.Pairs() { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true + } } } - } - return false - }) + return false + }, + ) std["context"] = struct{}{} @@ -311,37 +316,39 @@ func (i *importer) queryImports(filename string) fileImports { } } - std, pkg := buildImports(i.Options, gq, func(name string) bool { - for _, q := range gq { - if q.hasRetType() { - if q.Ret.EmitStruct() { - for _, f := range q.Ret.Struct.Fields { + std, pkg := buildImports( + i.Options, gq, func(name string) bool { + for _, q := range gq { + if q.hasRetType() { + if q.Ret.EmitStruct() { + for _, f := range q.Ret.Struct.Fields { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true + } + } + } + if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { + return true + } + } + // Check the fields of the argument struct if it's emitted + if q.Arg.EmitStruct() { + for _, f := range q.Arg.Struct.Fields { if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } } - if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { - return true - } - } - // Check the fields of the argument struct if it's emitted - if q.Arg.EmitStruct() { - for _, f := range q.Arg.Struct.Fields { + // Check the argument pairs inside the method definition + for _, f := range q.Arg.Pairs() { if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } } - // Check the argument pairs inside the method definition - for _, f := range q.Arg.Pairs() { - if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { - return true - } - } - } - return false - }) + return false + }, + ) sliceScan := func() bool { for _, q := range gq { @@ -402,6 +409,31 @@ func (i *importer) queryImports(filename string) fileImports { pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} } + // Search for sqlc.slice() calls + sqlcSortScan := func() bool { + for _, q := range gq { + if q.Arg.HasSqlcSorts() { + return true + } + } + return false + } + // Search for sqlc.slice() calls + sqlcSortNullScan := func() bool { + for _, q := range gq { + if q.Arg.HasSqlcNullSorts() { + return true + } + } + return false + } + if sqlcSortScan() && !sqlpkg.IsPGX() { + std["strings"] = struct{}{} + } + if sqlcSortNullScan() { + std["database/sql/driver"] = struct{}{} + } + if i.Options.WrapErrors { std["fmt"] = struct{}{} } @@ -416,21 +448,23 @@ func (i *importer) copyfromImports() fileImports { copyFromQueries = append(copyFromQueries, q) } } - std, pkg := buildImports(i.Options, copyFromQueries, func(name string) bool { - for _, q := range copyFromQueries { - if q.hasRetType() { - if strings.HasPrefix(q.Ret.Type(), name) { - return true + std, pkg := buildImports( + i.Options, copyFromQueries, func(name string) bool { + for _, q := range copyFromQueries { + if q.hasRetType() { + if strings.HasPrefix(q.Ret.Type(), name) { + return true + } } - } - if !q.Arg.isEmpty() { - if strings.HasPrefix(q.Arg.Type(), name) { - return true + if !q.Arg.isEmpty() { + if strings.HasPrefix(q.Arg.Type(), name) { + return true + } } } - } - return false - }) + return false + }, + ) std["context"] = struct{}{} if i.Options.SqlDriver == opts.SQLDriverGoSQLDriverMySQL { @@ -451,35 +485,37 @@ func (i *importer) batchImports() fileImports { batchQueries = append(batchQueries, q) } } - std, pkg := buildImports(i.Options, batchQueries, func(name string) bool { - for _, q := range batchQueries { - if q.hasRetType() { - if q.Ret.EmitStruct() { - for _, f := range q.Ret.Struct.Fields { + std, pkg := buildImports( + i.Options, batchQueries, func(name string) bool { + for _, q := range batchQueries { + if q.hasRetType() { + if q.Ret.EmitStruct() { + for _, f := range q.Ret.Struct.Fields { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true + } + } + } + if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { + return true + } + } + if q.Arg.EmitStruct() { + for _, f := range q.Arg.Struct.Fields { if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } } - if hasPrefixIgnoringSliceAndPointerPrefix(q.Ret.Type(), name) { - return true - } - } - if q.Arg.EmitStruct() { - for _, f := range q.Arg.Struct.Fields { + for _, f := range q.Arg.Pairs() { if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } } - for _, f := range q.Arg.Pairs() { - if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { - return true - } - } - } - return false - }) + return false + }, + ) std["context"] = struct{}{} std["errors"] = struct{}{} diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index 3b4fb2fa1a..f2426a5f4b 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -61,10 +61,12 @@ func (v QueryValue) Pairs() []Argument { if !v.EmitStruct() && v.IsStruct() { var out []Argument for _, f := range v.Struct.Fields { - out = append(out, Argument{ - Name: escape(toLowerCase(f.Name)), - Type: f.Type, - }) + out = append( + out, Argument{ + Name: escape(toLowerCase(f.Name)), + Type: f.Type, + }, + ) } return out } @@ -190,6 +192,34 @@ func (v QueryValue) HasSqlcSlices() bool { return false } +// When true, we have to build the arguments to q.db.QueryContext in addition to +// munging the SQL +func (v QueryValue) HasSqlcSorts() bool { + if v.Struct == nil { + return v.Column != nil && v.Column.SqlcSortOpts != nil + } + for _, v := range v.Struct.Fields { + if v.Column.SqlcSortOpts != nil { + return true + } + } + return false +} + +// When true, we have to build the arguments to q.db.QueryContext in addition to +// munging the SQL +func (v QueryValue) HasSqlcNullSorts() bool { + if v.Struct == nil { + return v.Column != nil && v.Column.SqlcSortOpts != nil && !v.Column.NotNull + } + for _, v := range v.Struct.Fields { + if v.Column.SqlcSortOpts != nil && !v.Column.NotNull { + return true + } + } + return false +} + func (v QueryValue) Scan() string { var out []string if v.Struct == nil { @@ -244,8 +274,8 @@ func (v QueryValue) CopyFromMySQLFields() []Field { } } -func (v QueryValue) VariableForField(f Field) string { - if !v.IsStruct() { +func (v QueryValue) Variable(f *Field) string { + if !v.IsStruct() || f == nil { return v.Name } if !v.EmitStruct() { @@ -254,6 +284,39 @@ func (v QueryValue) VariableForField(f Field) string { return v.Name + "." + f.Name } +func (v QueryValue) VariableType(f *Field) string { + if !v.IsStruct() || f == nil { + return v.Type() + } + return f.Type +} + +func (v QueryValue) VariableForField(f Field) string { + return v.Variable(&f) +} + +func (v QueryValue) VariableValue(f *Field) string { + name := v.Variable(f) + var isNull bool + if !v.IsStruct() || f == nil { + isNull = v.Column != nil && !v.Column.NotNull + } else { + isNull = f.Column != nil && !f.Column.NotNull + } + if isNull { + return fmt.Sprintf( + "(func() (driver.Value) {v, _ := %s.Value(); if v == nil {dv := %s{Valid: true}; v, _ = dv.Value()}; return v})()", + name, + v.VariableType(f), + ) + } + return name +} + +func (v QueryValue) VariableValueForField(f Field) string { + return v.VariableValue(&f) +} + // A struct used to generate methods and fields on the Queries struct type Query struct { Cmd string diff --git a/internal/codegen/golang/templates/stdlib/queryCode.tmpl b/internal/codegen/golang/templates/stdlib/queryCode.tmpl index 1e7f4e22a4..e1496823de 100644 --- a/internal/codegen/golang/templates/stdlib/queryCode.tmpl +++ b/internal/codegen/golang/templates/stdlib/queryCode.tmpl @@ -125,7 +125,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} {{end}} {{define "queryCodeStdExec"}} - {{- if .Arg.HasSqlcSlices }} + {{- if or .Arg.HasSqlcSlices .Arg.HasSqlcSorts }} query := {{.ConstantName}} var queryParams []interface{} {{- if .Arg.Struct }} @@ -140,23 +140,61 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} } else { query = strings.Replace(query, "/*SLICE:{{.Column.Name}}*/?", "NULL", 1) } + {{- else if .HasSqlcSort }} + {{- $opts := .SqlcSortOpts }} + {{- $defVal := $opts.DefaultField }} + {{- $replace := print "/*SORT:" .Column.Name ":" $defVal "*/?" }} + {{- $valVar := print "val" .Name }} + {{- if $opts.IsOrder }} + {{- $defVal = $opts.DefaultOrder }} + {{- $replace = print "/*ORDER:" .Column.Name ":" $defVal "*/" }} + {{- end }} + {{ $valVar }} := any({{$arg.VariableValueForField .}}).(string) + {{- if $defVal }} + if {{ $valVar }} == "" { + {{ $valVar }} = "{{ $defVal }}" + } + {{- end }} + {{- if $opts.IsOrder }} + {{ $valVar }} = strings.ToLower({{ $valVar }}) + if {{ $valVar }} != "asc" && {{ $valVar }} != "desc" { + {{ $valVar }} = "asc" + } + {{- else }} + if {{ $valVar }} == "" { + {{ $valVar }} = "1" + } + {{- end }} + query = strings.Replace(query, "{{$replace}}", {{ $valVar }}, 1) {{- else }} queryParams = append(queryParams, {{$arg.VariableForField .}}) {{- end }} {{- end }} {{- else }} - {{- /* Single argument parameter to this goroutine (they are not packed - in a struct), because .Arg.HasSqlcSlices further up above was true, - this section is 100% a slice (impossible to get here otherwise). - */}} - if len({{.Arg.Name}}) > 0 { - for _, v := range {{.Arg.Name}} { - queryParams = append(queryParams, v) + {{- if .Arg.HasSqlcSlices }} + {{- /* Single argument parameter to this goroutine (they are not packed + in a struct), because .Arg.HasSqlcSlices further up above was true, + this section is 100% a slice (impossible to get here otherwise). + */}} + if len({{.Arg.Name}}) > 0 { + for _, v := range {{.Arg.Name}} { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:{{.Arg.Column.Name}}*/?", strings.Repeat(",?", len({{.Arg.Name}}))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:{{.Arg.Column.Name}}*/?", "NULL", 1) + } + {{- else if .Arg.HasSqlcSorts }} + {{- /* Single argument parameter to this goroutine (they are not packed + in a struct), because .Arg.HasSqlcSorts further up above was true, + this section is 100% a slice (impossible to get here otherwise). + */}} + {{- $valVar := print .Arg.Name "Val" }} + {{ $valVar }} := any({{.Arg.VariableValue nil}}).(string) + if {{ $valVar }} != "" { + query = strings.Replace(query, "/*SORT:{{.Arg.Column.Name}}:*/?", {{ $valVar }}, 1) } - query = strings.Replace(query, "/*SLICE:{{.Arg.Column.Name}}*/?", strings.Repeat(",?", len({{.Arg.Name}}))[1:], 1) - } else { - query = strings.Replace(query, "/*SLICE:{{.Arg.Column.Name}}*/?", "NULL", 1) - } + {{- end }} {{- end }} {{- if emitPreparedQueries }} {{ queryRetval . }} {{ queryMethod . }}(ctx, nil, query, queryParams...) diff --git a/internal/compiler/analyze.go b/internal/compiler/analyze.go index 0d7d507575..d58a7ea819 100644 --- a/internal/compiler/analyze.go +++ b/internal/compiler/analyze.go @@ -44,6 +44,14 @@ func convertTypeName(id *analyzer.Identifier) *ast.TypeName { func convertColumn(c *analyzer.Column) *Column { length := int(c.Length) + var sortOpts *SqlcSortOpts + if c.SqlcSortOpts != nil { + sortOpts = &SqlcSortOpts{ + IsOrder: c.SqlcSortOpts.IsOrder, + DefaultField: c.SqlcSortOpts.DefaultField, + DefaultOrder: c.SqlcSortOpts.DefaultOrder, + } + } return &Column{ Name: c.Name, OriginalName: c.OriginalName, @@ -62,6 +70,7 @@ func convertColumn(c *analyzer.Column) *Column { Type: convertTypeName(c.Type), EmbedTable: convertTableName(c.EmbedTable), IsSqlcSlice: c.IsSqlcSlice, + SqlcSortOpts: sortOpts, } } @@ -72,10 +81,12 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { } var params []Parameter for _, p := range a.Params { - params = append(params, Parameter{ - Number: int(p.Number), - Column: convertColumn(p.Column), - }) + params = append( + params, Parameter{ + Number: int(p.Number), + Column: convertColumn(p.Column), + }, + ) } if len(prev.Columns) == len(cols) { for i := range prev.Columns { diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index 751cb3271a..64b851fb0f 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -102,10 +102,12 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, } var params []Parameter for _, p := range result.Params { - params = append(params, Parameter{ - Number: int(p.Number), - Column: convertColumn(p.Column), - }) + params = append( + params, Parameter{ + Number: int(p.Number), + Column: convertColumn(p.Column), + }, + ) } // Determine the insert table if applicable @@ -136,10 +138,12 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, // If the query uses star expansion, verify that it was edited. If not, // return an error. - stars := astutils.Search(raw, func(node ast.Node) bool { - _, ok := node.(*ast.A_Star) - return ok - }) + stars := astutils.Search( + raw, func(node ast.Node) bool { + _, ok := node.(*ast.A_Star) + return ok + }, + ) hasStars := len(stars.Items) > 0 unchanged := inference.Query == rawSQL if unchanged && hasStars { @@ -183,12 +187,14 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, func rangeVars(root ast.Node) []*ast.RangeVar { var vars []*ast.RangeVar - find := astutils.VisitorFunc(func(node ast.Node) { - switch n := node.(type) { - case *ast.RangeVar: - vars = append(vars, n) - } - }) + find := astutils.VisitorFunc( + func(node ast.Node) { + switch n := node.(type) { + case *ast.RangeVar: + vars = append(vars, n) + } + }, + ) astutils.Walk(find, root) return vars } diff --git a/internal/compiler/query.go b/internal/compiler/query.go index b3cf9d6154..2efd33c5c4 100644 --- a/internal/compiler/query.go +++ b/internal/compiler/query.go @@ -17,6 +17,12 @@ type Table struct { Columns []*Column } +type SqlcSortOpts struct { + IsOrder bool + DefaultField string + DefaultOrder string +} + type Column struct { Name string OriginalName string @@ -37,7 +43,8 @@ type Column struct { Type *ast.TypeName EmbedTable *ast.TableName - IsSqlcSlice bool // is this sqlc.slice() + IsSqlcSlice bool // is this sqlc.slice() + SqlcSortOpts *SqlcSortOpts // is this sqlc.sort() skipTableRequiredCheck bool } diff --git a/internal/compiler/resolve.go b/internal/compiler/resolve.go index b1fbb1990e..dc77de7008 100644 --- a/internal/compiler/resolve.go +++ b/internal/compiler/resolve.go @@ -21,7 +21,13 @@ func dataType(n *ast.TypeName) string { } } -func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds rewrite.EmbedSet) ([]Parameter, error) { +func (comp *Compiler) resolveCatalogRefs( + qc *QueryCatalog, + rvs []*ast.RangeVar, + args []paramRef, + params *named.ParamSet, + embeds rewrite.EmbedSet, +) ([]Parameter, error) { c := comp.catalog aliasMap := map[string]*ast.TableName{} @@ -102,14 +108,33 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, addUnknownParam := func(ref paramRef) { defaultP := named.NewInferredParam(ref.name, false) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - DataType: "any", - IsNamedParam: isNamed, + column := &Column{ + Name: p.Name(), + DataType: "any", + IsNamedParam: isNamed, + } + if p.IsSqlcSort() { + column.SqlcSortOpts = &SqlcSortOpts{} + column.DataType = "text" + column.NotNull = false + if _, ok := p.GetOpt(named.OptOrderDirParam); ok { + column.SqlcSortOpts.IsOrder = false + if d, ok := p.GetOpt(named.OptDefaultOrderFieldParam); ok { + column.SqlcSortOpts.DefaultField = d.(string) + } + } else { + column.SqlcSortOpts.IsOrder = true + if d, ok := p.GetOpt(named.OptDefaultOrderDirParam); ok { + column.SqlcSortOpts.DefaultOrder = d.(string) + } + } + } + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: column, }, - }) + ) } for _, ref := range args { @@ -118,41 +143,49 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, case *limitOffset: defaultP := named.NewInferredParam("offset", true) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - DataType: "integer", - NotNull: p.NotNull(), - IsNamedParam: isNamed, + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + DataType: "integer", + NotNull: p.NotNull(), + IsNamedParam: isNamed, + }, }, - }) + ) case *limitCount: defaultP := named.NewInferredParam("limit", true) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - DataType: "integer", - NotNull: p.NotNull(), - IsNamedParam: isNamed, + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + DataType: "integer", + NotNull: p.NotNull(), + IsNamedParam: isNamed, + }, }, - }) + ) case *ast.A_Expr: // TODO: While this works for a wide range of simple expressions, // more complicated expressions will cause this logic to fail. - list := astutils.Search(n.Lexpr, func(node ast.Node) bool { - _, ok := node.(*ast.ColumnRef) - return ok - }) - if len(list.Items) == 0 { - list = astutils.Search(n.Rexpr, func(node ast.Node) bool { + list := astutils.Search( + n.Lexpr, func(node ast.Node) bool { _, ok := node.(*ast.ColumnRef) return ok - }) + }, + ) + if len(list.Items) == 0 { + list = astutils.Search( + n.Rexpr, func(node ast.Node) bool { + _, ok := node.(*ast.ColumnRef) + return ok + }, + ) } if len(list.Items) == 0 { @@ -164,16 +197,18 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewParam("") p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - DataType: dataType, - IsNamedParam: isNamed, - NotNull: p.NotNull(), - IsSqlcSlice: p.IsSqlcSlice(), + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + DataType: dataType, + IsNamedParam: isNamed, + NotNull: p.NotNull(), + IsSqlcSlice: p.IsSqlcSlice(), + }, }, - }) + ) continue } @@ -231,22 +266,24 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewInferredParam(key, c.IsNotNull) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - OriginalName: c.Name, - DataType: dataType(&c.Type), - NotNull: p.NotNull(), - Unsigned: c.IsUnsigned, - IsArray: c.IsArray, - ArrayDims: c.ArrayDims, - Length: c.Length, - Table: table, - IsNamedParam: isNamed, - IsSqlcSlice: p.IsSqlcSlice(), + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + OriginalName: c.Name, + DataType: dataType(&c.Type), + NotNull: p.NotNull(), + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Length: c.Length, + Table: table, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), + }, }, - }) + ) } } @@ -298,20 +335,22 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } } - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: namePrefix + p.Name(), - DataType: dataType(&c.Type), - NotNull: p.NotNull(), - Unsigned: c.IsUnsigned, - IsArray: c.IsArray, - ArrayDims: c.ArrayDims, - Table: table, - IsNamedParam: isNamed, - IsSqlcSlice: p.IsSqlcSlice(), + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: namePrefix + p.Name(), + DataType: dataType(&c.Type), + NotNull: p.NotNull(), + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Table: table, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), + }, }, - }) + ) } } @@ -322,9 +361,11 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, // for an unknown Postgres function (e.g. defined in an extension) var args []*catalog.Argument for range n.Args.Items { - args = append(args, &catalog.Argument{ - Type: &ast.TypeName{Name: "any"}, - }) + args = append( + args, &catalog.Argument{ + Type: &ast.TypeName{Name: "any"}, + }, + ) } fun = &catalog.Function{ Name: n.Func.Name, @@ -374,16 +415,18 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewInferredParam(defaultName, false) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) added = true - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - DataType: "any", - IsNamedParam: isNamed, - NotNull: p.NotNull(), - IsSqlcSlice: p.IsSqlcSlice(), + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + DataType: "any", + IsNamedParam: isNamed, + NotNull: p.NotNull(), + IsSqlcSlice: p.IsSqlcSlice(), + }, }, - }) + ) continue } @@ -416,16 +459,18 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewInferredParam(paramName, true) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) added = true - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - DataType: dataType(paramType), - NotNull: p.NotNull(), - IsNamedParam: isNamed, - IsSqlcSlice: p.IsSqlcSlice(), + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + DataType: dataType(paramType), + NotNull: p.NotNull(), + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), + }, }, - }) + ) } if fun.ReturnType == nil { @@ -435,11 +480,13 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, continue } - table, err := c.GetTable(&ast.TableName{ - Catalog: fun.ReturnType.Catalog, - Schema: fun.ReturnType.Schema, - Name: fun.ReturnType.Name, - }) + table, err := c.GetTable( + &ast.TableName{ + Catalog: fun.ReturnType.Catalog, + Schema: fun.ReturnType.Schema, + Name: fun.ReturnType.Name, + }, + ) if err != nil { if !added { addUnknownParam(ref) @@ -483,22 +530,24 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, if c, ok := tableMap[key]; ok { defaultP := named.NewInferredParam(key, c.IsNotNull) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - OriginalName: c.Name, - DataType: dataType(&c.Type), - NotNull: p.NotNull(), - Unsigned: c.IsUnsigned, - IsArray: c.IsArray, - ArrayDims: c.ArrayDims, - Table: &ast.TableName{Schema: schema, Name: rel}, - Length: c.Length, - IsNamedParam: isNamed, - IsSqlcSlice: p.IsSqlcSlice(), + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + OriginalName: c.Name, + DataType: dataType(&c.Type), + NotNull: p.NotNull(), + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Table: &ast.TableName{Schema: schema, Name: rel}, + Length: c.Length, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), + }, }, - }) + ) } else { return nil, &sqlerr.Error{ Code: "42703", @@ -517,10 +566,12 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, col.Name = p.Name() col.NotNull = p.NotNull() - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: col, - }) + a = append( + a, Parameter{ + Number: ref.ref.Number, + Column: col, + }, + ) case *ast.ParamRef: a = append(a, Parameter{Number: ref.ref.Number}) @@ -594,21 +645,23 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } defaultP := named.NewInferredParam(key, c.IsNotNull) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: number, - Column: &Column{ - Name: p.Name(), - OriginalName: c.Name, - DataType: dataType(&c.Type), - NotNull: c.IsNotNull, - Unsigned: c.IsUnsigned, - IsArray: c.IsArray, - ArrayDims: c.ArrayDims, - Table: table, - IsNamedParam: isNamed, - IsSqlcSlice: p.IsSqlcSlice(), + a = append( + a, Parameter{ + Number: number, + Column: &Column{ + Name: p.Name(), + OriginalName: c.Name, + DataType: dataType(&c.Type), + NotNull: c.IsNotNull, + Unsigned: c.IsUnsigned, + IsArray: c.IsArray, + ArrayDims: c.ArrayDims, + Table: table, + IsNamedParam: isNamed, + IsSqlcSlice: p.IsSqlcSlice(), + }, }, - }) + ) } } } diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 525ffc72ef..fb4c597498 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: plugin/codegen.proto @@ -21,21 +21,18 @@ const ( ) type File struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"` + sizeCache protoimpl.SizeCache } func (x *File) Reset() { *x = File{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *File) String() string { @@ -46,7 +43,7 @@ func (*File) ProtoMessage() {} func (x *File) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -76,24 +73,21 @@ func (x *File) GetContents() []byte { } type Settings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` + Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` + Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` + Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` unknownFields protoimpl.UnknownFields - - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` - Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` - Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` - Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Settings) Reset() { *x = Settings{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Settings) String() string { @@ -104,7 +98,7 @@ func (*Settings) ProtoMessage() {} func (x *Settings) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -155,25 +149,22 @@ func (x *Settings) GetCodegen() *Codegen { } type Codegen struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Out string `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` + Plugin string `protobuf:"bytes,2,opt,name=plugin,proto3" json:"plugin,omitempty"` + Options []byte `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` + Env []string `protobuf:"bytes,4,rep,name=env,proto3" json:"env,omitempty"` + Process *Codegen_Process `protobuf:"bytes,5,opt,name=process,proto3" json:"process,omitempty"` + Wasm *Codegen_WASM `protobuf:"bytes,6,opt,name=wasm,proto3" json:"wasm,omitempty"` unknownFields protoimpl.UnknownFields - - Out string `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` - Plugin string `protobuf:"bytes,2,opt,name=plugin,proto3" json:"plugin,omitempty"` - Options []byte `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` - Env []string `protobuf:"bytes,4,rep,name=env,proto3" json:"env,omitempty"` - Process *Codegen_Process `protobuf:"bytes,5,opt,name=process,proto3" json:"process,omitempty"` - Wasm *Codegen_WASM `protobuf:"bytes,6,opt,name=wasm,proto3" json:"wasm,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Codegen) Reset() { *x = Codegen{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Codegen) String() string { @@ -184,7 +175,7 @@ func (*Codegen) ProtoMessage() {} func (x *Codegen) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -242,23 +233,20 @@ func (x *Codegen) GetWasm() *Codegen_WASM { } type Catalog struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` + DefaultSchema string `protobuf:"bytes,2,opt,name=default_schema,json=defaultSchema,proto3" json:"default_schema,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Schemas []*Schema `protobuf:"bytes,4,rep,name=schemas,proto3" json:"schemas,omitempty"` unknownFields protoimpl.UnknownFields - - Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` - DefaultSchema string `protobuf:"bytes,2,opt,name=default_schema,json=defaultSchema,proto3" json:"default_schema,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Schemas []*Schema `protobuf:"bytes,4,rep,name=schemas,proto3" json:"schemas,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Catalog) Reset() { *x = Catalog{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Catalog) String() string { @@ -269,7 +257,7 @@ func (*Catalog) ProtoMessage() {} func (x *Catalog) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -313,24 +301,21 @@ func (x *Catalog) GetSchemas() []*Schema { } type Schema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Tables []*Table `protobuf:"bytes,3,rep,name=tables,proto3" json:"tables,omitempty"` - Enums []*Enum `protobuf:"bytes,4,rep,name=enums,proto3" json:"enums,omitempty"` - CompositeTypes []*CompositeType `protobuf:"bytes,5,rep,name=composite_types,json=compositeTypes,proto3" json:"composite_types,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Tables []*Table `protobuf:"bytes,3,rep,name=tables,proto3" json:"tables,omitempty"` + Enums []*Enum `protobuf:"bytes,4,rep,name=enums,proto3" json:"enums,omitempty"` + CompositeTypes []*CompositeType `protobuf:"bytes,5,rep,name=composite_types,json=compositeTypes,proto3" json:"composite_types,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Schema) Reset() { *x = Schema{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Schema) String() string { @@ -341,7 +326,7 @@ func (*Schema) ProtoMessage() {} func (x *Schema) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -392,21 +377,18 @@ func (x *Schema) GetCompositeTypes() []*CompositeType { } type CompositeType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Comment string `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Comment string `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CompositeType) Reset() { *x = CompositeType{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CompositeType) String() string { @@ -417,7 +399,7 @@ func (*CompositeType) ProtoMessage() {} func (x *CompositeType) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -447,22 +429,19 @@ func (x *CompositeType) GetComment() string { } type Enum struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Vals []string `protobuf:"bytes,2,rep,name=vals,proto3" json:"vals,omitempty"` + Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Vals []string `protobuf:"bytes,2,rep,name=vals,proto3" json:"vals,omitempty"` - Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Enum) Reset() { *x = Enum{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Enum) String() string { @@ -473,7 +452,7 @@ func (*Enum) ProtoMessage() {} func (x *Enum) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -510,22 +489,19 @@ func (x *Enum) GetComment() string { } type Table struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Rel *Identifier `protobuf:"bytes,1,opt,name=rel,proto3" json:"rel,omitempty"` + Columns []*Column `protobuf:"bytes,2,rep,name=columns,proto3" json:"columns,omitempty"` + Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` unknownFields protoimpl.UnknownFields - - Rel *Identifier `protobuf:"bytes,1,opt,name=rel,proto3" json:"rel,omitempty"` - Columns []*Column `protobuf:"bytes,2,rep,name=columns,proto3" json:"columns,omitempty"` - Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Table) Reset() { *x = Table{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Table) String() string { @@ -536,7 +512,7 @@ func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -573,22 +549,19 @@ func (x *Table) GetComment() string { } type Identifier struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` + Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields - - Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` - Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Identifier) Reset() { *x = Identifier{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Identifier) String() string { @@ -599,7 +572,7 @@ func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -635,37 +608,95 @@ func (x *Identifier) GetName() string { return "" } -type Column struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache +type SqlcSortOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + IsOrder bool `protobuf:"varint,1,opt,name=is_order,json=isOrder,proto3" json:"is_order,omitempty"` + DefaultField string `protobuf:"bytes,2,opt,name=default_field,json=defaultField,proto3" json:"default_field,omitempty"` + DefaultOrder string `protobuf:"bytes,3,opt,name=default_order,json=defaultOrder,proto3" json:"default_order,omitempty"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SqlcSortOpts) Reset() { + *x = SqlcSortOpts{} + mi := &file_plugin_codegen_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SqlcSortOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SqlcSortOpts) ProtoMessage() {} + +func (x *SqlcSortOpts) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SqlcSortOpts.ProtoReflect.Descriptor instead. +func (*SqlcSortOpts) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{9} +} + +func (x *SqlcSortOpts) GetIsOrder() bool { + if x != nil { + return x.IsOrder + } + return false +} + +func (x *SqlcSortOpts) GetDefaultField() string { + if x != nil { + return x.DefaultField + } + return "" +} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - NotNull bool `protobuf:"varint,3,opt,name=not_null,json=notNull,proto3" json:"not_null,omitempty"` - IsArray bool `protobuf:"varint,4,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"` - Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:"comment,omitempty"` - Length int32 `protobuf:"varint,6,opt,name=length,proto3" json:"length,omitempty"` - IsNamedParam bool `protobuf:"varint,7,opt,name=is_named_param,json=isNamedParam,proto3" json:"is_named_param,omitempty"` - IsFuncCall bool `protobuf:"varint,8,opt,name=is_func_call,json=isFuncCall,proto3" json:"is_func_call,omitempty"` +func (x *SqlcSortOpts) GetDefaultOrder() string { + if x != nil { + return x.DefaultOrder + } + return "" +} + +type Column struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + NotNull bool `protobuf:"varint,3,opt,name=not_null,json=notNull,proto3" json:"not_null,omitempty"` + IsArray bool `protobuf:"varint,4,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"` + Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:"comment,omitempty"` + Length int32 `protobuf:"varint,6,opt,name=length,proto3" json:"length,omitempty"` + IsNamedParam bool `protobuf:"varint,7,opt,name=is_named_param,json=isNamedParam,proto3" json:"is_named_param,omitempty"` + IsFuncCall bool `protobuf:"varint,8,opt,name=is_func_call,json=isFuncCall,proto3" json:"is_func_call,omitempty"` // XXX: Figure out what PostgreSQL calls `foo.id` - Scope string `protobuf:"bytes,9,opt,name=scope,proto3" json:"scope,omitempty"` - Table *Identifier `protobuf:"bytes,10,opt,name=table,proto3" json:"table,omitempty"` - TableAlias string `protobuf:"bytes,11,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"` - Type *Identifier `protobuf:"bytes,12,opt,name=type,proto3" json:"type,omitempty"` - IsSqlcSlice bool `protobuf:"varint,13,opt,name=is_sqlc_slice,json=isSqlcSlice,proto3" json:"is_sqlc_slice,omitempty"` - EmbedTable *Identifier `protobuf:"bytes,14,opt,name=embed_table,json=embedTable,proto3" json:"embed_table,omitempty"` - OriginalName string `protobuf:"bytes,15,opt,name=original_name,json=originalName,proto3" json:"original_name,omitempty"` - Unsigned bool `protobuf:"varint,16,opt,name=unsigned,proto3" json:"unsigned,omitempty"` - ArrayDims int32 `protobuf:"varint,17,opt,name=array_dims,json=arrayDims,proto3" json:"array_dims,omitempty"` + Scope string `protobuf:"bytes,9,opt,name=scope,proto3" json:"scope,omitempty"` + Table *Identifier `protobuf:"bytes,10,opt,name=table,proto3" json:"table,omitempty"` + TableAlias string `protobuf:"bytes,11,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"` + Type *Identifier `protobuf:"bytes,12,opt,name=type,proto3" json:"type,omitempty"` + IsSqlcSlice bool `protobuf:"varint,13,opt,name=is_sqlc_slice,json=isSqlcSlice,proto3" json:"is_sqlc_slice,omitempty"` + SqlcSortOpts *SqlcSortOpts `protobuf:"bytes,18,opt,name=sqlc_sort_opts,json=sqlcSortOpts,proto3,oneof" json:"sqlc_sort_opts,omitempty"` + EmbedTable *Identifier `protobuf:"bytes,14,opt,name=embed_table,json=embedTable,proto3" json:"embed_table,omitempty"` + OriginalName string `protobuf:"bytes,15,opt,name=original_name,json=originalName,proto3" json:"original_name,omitempty"` + Unsigned bool `protobuf:"varint,16,opt,name=unsigned,proto3" json:"unsigned,omitempty"` + ArrayDims int32 `protobuf:"varint,17,opt,name=array_dims,json=arrayDims,proto3" json:"array_dims,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Column) Reset() { *x = Column{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Column) String() string { @@ -675,8 +706,8 @@ func (x *Column) String() string { func (*Column) ProtoMessage() {} func (x *Column) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_plugin_codegen_proto_msgTypes[10] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -688,7 +719,7 @@ func (x *Column) ProtoReflect() protoreflect.Message { // Deprecated: Use Column.ProtoReflect.Descriptor instead. func (*Column) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{9} + return file_plugin_codegen_proto_rawDescGZIP(), []int{10} } func (x *Column) GetName() string { @@ -775,6 +806,13 @@ func (x *Column) GetIsSqlcSlice() bool { return false } +func (x *Column) GetSqlcSortOpts() *SqlcSortOpts { + if x != nil { + return x.SqlcSortOpts + } + return nil +} + func (x *Column) GetEmbedTable() *Identifier { if x != nil { return x.EmbedTable @@ -804,27 +842,24 @@ func (x *Column) GetArrayDims() int32 { } type Query struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` - Columns []*Column `protobuf:"bytes,4,rep,name=columns,proto3" json:"columns,omitempty"` - Params []*Parameter `protobuf:"bytes,5,rep,name=params,json=parameters,proto3" json:"params,omitempty"` - Comments []string `protobuf:"bytes,6,rep,name=comments,proto3" json:"comments,omitempty"` - Filename string `protobuf:"bytes,7,opt,name=filename,proto3" json:"filename,omitempty"` - InsertIntoTable *Identifier `protobuf:"bytes,8,opt,name=insert_into_table,proto3" json:"insert_into_table,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` + Columns []*Column `protobuf:"bytes,4,rep,name=columns,proto3" json:"columns,omitempty"` + Params []*Parameter `protobuf:"bytes,5,rep,name=params,json=parameters,proto3" json:"params,omitempty"` + Comments []string `protobuf:"bytes,6,rep,name=comments,proto3" json:"comments,omitempty"` + Filename string `protobuf:"bytes,7,opt,name=filename,proto3" json:"filename,omitempty"` + InsertIntoTable *Identifier `protobuf:"bytes,8,opt,name=insert_into_table,proto3" json:"insert_into_table,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Query) Reset() { *x = Query{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Query) String() string { @@ -834,8 +869,8 @@ func (x *Query) String() string { func (*Query) ProtoMessage() {} func (x *Query) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_plugin_codegen_proto_msgTypes[11] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -847,7 +882,7 @@ func (x *Query) ProtoReflect() protoreflect.Message { // Deprecated: Use Query.ProtoReflect.Descriptor instead. func (*Query) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{10} + return file_plugin_codegen_proto_rawDescGZIP(), []int{11} } func (x *Query) GetText() string { @@ -907,21 +942,18 @@ func (x *Query) GetInsertIntoTable() *Identifier { } type Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + Column *Column `protobuf:"bytes,2,opt,name=column,proto3" json:"column,omitempty"` unknownFields protoimpl.UnknownFields - - Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` - Column *Column `protobuf:"bytes,2,opt,name=column,proto3" json:"column,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Parameter) Reset() { *x = Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Parameter) String() string { @@ -931,8 +963,8 @@ func (x *Parameter) String() string { func (*Parameter) ProtoMessage() {} func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_plugin_codegen_proto_msgTypes[12] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -944,7 +976,7 @@ func (x *Parameter) ProtoReflect() protoreflect.Message { // Deprecated: Use Parameter.ProtoReflect.Descriptor instead. func (*Parameter) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{11} + return file_plugin_codegen_proto_rawDescGZIP(), []int{12} } func (x *Parameter) GetNumber() int32 { @@ -962,25 +994,22 @@ func (x *Parameter) GetColumn() *Column { } type GenerateRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Settings *Settings `protobuf:"bytes,1,opt,name=settings,proto3" json:"settings,omitempty"` + Catalog *Catalog `protobuf:"bytes,2,opt,name=catalog,proto3" json:"catalog,omitempty"` + Queries []*Query `protobuf:"bytes,3,rep,name=queries,proto3" json:"queries,omitempty"` + SqlcVersion string `protobuf:"bytes,4,opt,name=sqlc_version,proto3" json:"sqlc_version,omitempty"` + PluginOptions []byte `protobuf:"bytes,5,opt,name=plugin_options,proto3" json:"plugin_options,omitempty"` + GlobalOptions []byte `protobuf:"bytes,6,opt,name=global_options,proto3" json:"global_options,omitempty"` unknownFields protoimpl.UnknownFields - - Settings *Settings `protobuf:"bytes,1,opt,name=settings,proto3" json:"settings,omitempty"` - Catalog *Catalog `protobuf:"bytes,2,opt,name=catalog,proto3" json:"catalog,omitempty"` - Queries []*Query `protobuf:"bytes,3,rep,name=queries,proto3" json:"queries,omitempty"` - SqlcVersion string `protobuf:"bytes,4,opt,name=sqlc_version,proto3" json:"sqlc_version,omitempty"` - PluginOptions []byte `protobuf:"bytes,5,opt,name=plugin_options,proto3" json:"plugin_options,omitempty"` - GlobalOptions []byte `protobuf:"bytes,6,opt,name=global_options,proto3" json:"global_options,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GenerateRequest) Reset() { *x = GenerateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GenerateRequest) String() string { @@ -990,8 +1019,8 @@ func (x *GenerateRequest) String() string { func (*GenerateRequest) ProtoMessage() {} func (x *GenerateRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_plugin_codegen_proto_msgTypes[13] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1003,7 +1032,7 @@ func (x *GenerateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead. func (*GenerateRequest) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{12} + return file_plugin_codegen_proto_rawDescGZIP(), []int{13} } func (x *GenerateRequest) GetSettings() *Settings { @@ -1049,20 +1078,17 @@ func (x *GenerateRequest) GetGlobalOptions() []byte { } type GenerateResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` unknownFields protoimpl.UnknownFields - - Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + sizeCache protoimpl.SizeCache } func (x *GenerateResponse) Reset() { *x = GenerateResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GenerateResponse) String() string { @@ -1072,8 +1098,8 @@ func (x *GenerateResponse) String() string { func (*GenerateResponse) ProtoMessage() {} func (x *GenerateResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_plugin_codegen_proto_msgTypes[14] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1085,7 +1111,7 @@ func (x *GenerateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead. func (*GenerateResponse) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{13} + return file_plugin_codegen_proto_rawDescGZIP(), []int{14} } func (x *GenerateResponse) GetFiles() []*File { @@ -1096,20 +1122,17 @@ func (x *GenerateResponse) GetFiles() []*File { } type Codegen_Process struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Cmd string `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"` unknownFields protoimpl.UnknownFields - - Cmd string `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Codegen_Process) Reset() { *x = Codegen_Process{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Codegen_Process) String() string { @@ -1119,8 +1142,8 @@ func (x *Codegen_Process) String() string { func (*Codegen_Process) ProtoMessage() {} func (x *Codegen_Process) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_plugin_codegen_proto_msgTypes[15] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1143,21 +1166,18 @@ func (x *Codegen_Process) GetCmd() string { } type Codegen_WASM struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Sha256 string `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - Sha256 string `protobuf:"bytes,2,opt,name=sha256,proto3" json:"sha256,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Codegen_WASM) Reset() { *x = Codegen_WASM{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_plugin_codegen_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Codegen_WASM) String() string { @@ -1167,8 +1187,8 @@ func (x *Codegen_WASM) String() string { func (*Codegen_WASM) ProtoMessage() {} func (x *Codegen_WASM) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_plugin_codegen_proto_msgTypes[16] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1275,96 +1295,109 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x04, - 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, - 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, - 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, - 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, - 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, - 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, - 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, - 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, - 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, - 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x22, 0x94, - 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, - 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, - 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, - 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, - 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, - 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x22, 0x87, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, - 0x27, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, - 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, 0x6c, - 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x36, 0x0a, 0x10, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x32, 0x4f, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, - 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x73, 0x0a, + 0x0c, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x19, 0x0a, + 0x08, 0x69, 0x73, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x69, 0x73, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x23, 0x0a, + 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x22, 0xe2, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, + 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, + 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, + 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, + 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, + 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0b, 0x69, 0x73, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x3f, + 0x0a, 0x0e, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x73, + 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x73, 0x48, 0x00, 0x52, 0x0c, + 0x73, 0x71, 0x6c, 0x63, 0x53, 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x73, 0x88, 0x01, 0x01, 0x12, + 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, + 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, + 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, + 0x44, 0x69, 0x6d, 0x73, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, 0x6f, + 0x72, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x22, 0x94, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, + 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, + 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x4b, + 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0x87, 0x02, 0x0a, 0x0f, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, + 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, + 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x27, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, + 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, + 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, + 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x36, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0x4f, 0x0a, + 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x3d, 0x0a, 0x08, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7c, + 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, + 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, + 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1379,8 +1412,8 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 16) -var file_plugin_codegen_proto_goTypes = []interface{}{ +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_plugin_codegen_proto_goTypes = []any{ (*File)(nil), // 0: plugin.File (*Settings)(nil), // 1: plugin.Settings (*Codegen)(nil), // 2: plugin.Codegen @@ -1390,42 +1423,44 @@ var file_plugin_codegen_proto_goTypes = []interface{}{ (*Enum)(nil), // 6: plugin.Enum (*Table)(nil), // 7: plugin.Table (*Identifier)(nil), // 8: plugin.Identifier - (*Column)(nil), // 9: plugin.Column - (*Query)(nil), // 10: plugin.Query - (*Parameter)(nil), // 11: plugin.Parameter - (*GenerateRequest)(nil), // 12: plugin.GenerateRequest - (*GenerateResponse)(nil), // 13: plugin.GenerateResponse - (*Codegen_Process)(nil), // 14: plugin.Codegen.Process - (*Codegen_WASM)(nil), // 15: plugin.Codegen.WASM + (*SqlcSortOpts)(nil), // 9: plugin.SqlcSortOpts + (*Column)(nil), // 10: plugin.Column + (*Query)(nil), // 11: plugin.Query + (*Parameter)(nil), // 12: plugin.Parameter + (*GenerateRequest)(nil), // 13: plugin.GenerateRequest + (*GenerateResponse)(nil), // 14: plugin.GenerateResponse + (*Codegen_Process)(nil), // 15: plugin.Codegen.Process + (*Codegen_WASM)(nil), // 16: plugin.Codegen.WASM } var file_plugin_codegen_proto_depIdxs = []int32{ 2, // 0: plugin.Settings.codegen:type_name -> plugin.Codegen - 14, // 1: plugin.Codegen.process:type_name -> plugin.Codegen.Process - 15, // 2: plugin.Codegen.wasm:type_name -> plugin.Codegen.WASM + 15, // 1: plugin.Codegen.process:type_name -> plugin.Codegen.Process + 16, // 2: plugin.Codegen.wasm:type_name -> plugin.Codegen.WASM 4, // 3: plugin.Catalog.schemas:type_name -> plugin.Schema 7, // 4: plugin.Schema.tables:type_name -> plugin.Table 6, // 5: plugin.Schema.enums:type_name -> plugin.Enum 5, // 6: plugin.Schema.composite_types:type_name -> plugin.CompositeType 8, // 7: plugin.Table.rel:type_name -> plugin.Identifier - 9, // 8: plugin.Table.columns:type_name -> plugin.Column + 10, // 8: plugin.Table.columns:type_name -> plugin.Column 8, // 9: plugin.Column.table:type_name -> plugin.Identifier 8, // 10: plugin.Column.type:type_name -> plugin.Identifier - 8, // 11: plugin.Column.embed_table:type_name -> plugin.Identifier - 9, // 12: plugin.Query.columns:type_name -> plugin.Column - 11, // 13: plugin.Query.params:type_name -> plugin.Parameter - 8, // 14: plugin.Query.insert_into_table:type_name -> plugin.Identifier - 9, // 15: plugin.Parameter.column:type_name -> plugin.Column - 1, // 16: plugin.GenerateRequest.settings:type_name -> plugin.Settings - 3, // 17: plugin.GenerateRequest.catalog:type_name -> plugin.Catalog - 10, // 18: plugin.GenerateRequest.queries:type_name -> plugin.Query - 0, // 19: plugin.GenerateResponse.files:type_name -> plugin.File - 12, // 20: plugin.CodegenService.Generate:input_type -> plugin.GenerateRequest - 13, // 21: plugin.CodegenService.Generate:output_type -> plugin.GenerateResponse - 21, // [21:22] is the sub-list for method output_type - 20, // [20:21] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 9, // 11: plugin.Column.sqlc_sort_opts:type_name -> plugin.SqlcSortOpts + 8, // 12: plugin.Column.embed_table:type_name -> plugin.Identifier + 10, // 13: plugin.Query.columns:type_name -> plugin.Column + 12, // 14: plugin.Query.params:type_name -> plugin.Parameter + 8, // 15: plugin.Query.insert_into_table:type_name -> plugin.Identifier + 10, // 16: plugin.Parameter.column:type_name -> plugin.Column + 1, // 17: plugin.GenerateRequest.settings:type_name -> plugin.Settings + 3, // 18: plugin.GenerateRequest.catalog:type_name -> plugin.Catalog + 11, // 19: plugin.GenerateRequest.queries:type_name -> plugin.Query + 0, // 20: plugin.GenerateResponse.files:type_name -> plugin.File + 13, // 21: plugin.CodegenService.Generate:input_type -> plugin.GenerateRequest + 14, // 22: plugin.CodegenService.Generate:output_type -> plugin.GenerateResponse + 22, // [22:23] is the sub-list for method output_type + 21, // [21:22] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name } func init() { file_plugin_codegen_proto_init() } @@ -1433,207 +1468,14 @@ func file_plugin_codegen_proto_init() { if File_plugin_codegen_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_plugin_codegen_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*File); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Settings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Codegen); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Catalog); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CompositeType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Enum); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Table); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Column); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Query); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenerateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenerateResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Codegen_Process); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Codegen_WASM); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } + file_plugin_codegen_proto_msgTypes[10].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 16, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/sql/named/CLAUDE.md b/internal/sql/named/CLAUDE.md index 05ba358ee9..7cd9b838bd 100644 --- a/internal/sql/named/CLAUDE.md +++ b/internal/sql/named/CLAUDE.md @@ -15,7 +15,7 @@ func IsParamFunc(node ast.Node) bool { return false } return call.Func.Schema == "sqlc" && - (call.Func.Name == "arg" || call.Func.Name == "narg" || call.Func.Name == "slice") + (call.Func.Name == "arg" || call.Func.Name == "narg" || call.Func.Name == "slice" || call.Func.Name == "sort") } ``` diff --git a/internal/sql/named/is.go b/internal/sql/named/is.go index d53c1d9905..4e544943f1 100644 --- a/internal/sql/named/is.go +++ b/internal/sql/named/is.go @@ -16,7 +16,7 @@ func IsParamFunc(node ast.Node) bool { return false } - isValid := call.Func.Schema == "sqlc" && (call.Func.Name == "arg" || call.Func.Name == "narg" || call.Func.Name == "slice") + isValid := call.Func.Schema == "sqlc" && (call.Func.Name == "arg" || call.Func.Name == "narg" || call.Func.Name == "slice" || call.Func.Name == "sort") return isValid } diff --git a/internal/sql/named/param.go b/internal/sql/named/param.go index 42f9b855a3..74e12c0694 100644 --- a/internal/sql/named/param.go +++ b/internal/sql/named/param.go @@ -37,6 +37,17 @@ func (n nullability) String() string { } } +const ( + FuncSlice = "slice" + FuncSort = "sort" +) + +const ( + OptOrderDirParam = "orderDirParam" + OptDefaultOrderFieldParam = "defaultOrderFieldParam" + OptDefaultOrderDirParam = "defaultOrderDirParam" +) + // Param represents a input argument to the query which can be specified using: // - positional parameters $1 // - named parameter operator @param @@ -44,7 +55,8 @@ func (n nullability) String() string { type Param struct { name string nullability nullability - isSqlcSlice bool + sqlcFunc string + opts map[string]interface{} } // NewParam builds a new params with unspecified nullability @@ -69,7 +81,17 @@ func NewUserNullableParam(name string) Param { // NewSqlcSlice is a sqlc.slice() parameter. func NewSqlcSlice(name string) Param { - return Param{name: name, nullability: nullUnspecified, isSqlcSlice: true} + return Param{name: name, nullability: nullUnspecified, sqlcFunc: FuncSlice} +} + +// NewSqlcSort is a sqlc.sort() parameter. +func NewSqlcSort(name string, opts map[string]interface{}) Param { + return Param{name: name, nullability: notNullable, sqlcFunc: FuncSort, opts: opts} +} + +// NewSqlcSortOrder is a sqlc.sort() parameter for order. +func NewSqlcSortOrder(name string, opts map[string]interface{}) Param { + return Param{name: name, nullability: notNullable, sqlcFunc: FuncSort, opts: opts} } // Name is the user defined name to use for this parameter @@ -108,9 +130,32 @@ func (p Param) NotNull() bool { return null } -// IsSlice returns whether this param is a sqlc.slice() param. +func (p Param) IsSqlcFunc(name string) bool { + return p.sqlcFunc != "" && p.sqlcFunc == name +} + +// IsSqlcSlice returns whether this param is a sqlc.slice() param. func (p Param) IsSqlcSlice() bool { - return p.isSqlcSlice + return p.IsSqlcFunc(FuncSlice) +} + +// IsSqlcSort returns whether this param is a sqlc.sort() param. +func (p Param) IsSqlcSort() bool { + return p.IsSqlcFunc(FuncSort) +} + +// GetOpts returns sqlc.sort() opts. +func (p Param) GetOpts() map[string]interface{} { + return p.opts +} + +// GetOpt returns sqlc.sort() opts. +func (p Param) GetOpt(name string) (interface{}, bool) { + if p.opts == nil { + return nil, false + } + opt, ok := p.opts[name] + return opt, ok } // mergeParam creates a new param from 2 partially specified params @@ -120,10 +165,24 @@ func mergeParam(a, b Param) Param { if name == "" { name = b.name } + sqlcFunc := a.sqlcFunc + if sqlcFunc == "" { + sqlcFunc = b.sqlcFunc + } + + opts := a.GetOpts() + if opts == nil { + opts = b.GetOpts() + } else if b.GetOpts() != nil { + for k, v := range b.GetOpts() { + opts[k] = v + } + } return Param{ name: name, nullability: a.nullability | b.nullability, - isSqlcSlice: a.isSqlcSlice || b.isSqlcSlice, + sqlcFunc: sqlcFunc, + opts: opts, } } diff --git a/internal/sql/rewrite/parameters.go b/internal/sql/rewrite/parameters.go index d1ea1a22cc..2d0e12a32f 100644 --- a/internal/sql/rewrite/parameters.go +++ b/internal/sql/rewrite/parameters.go @@ -47,13 +47,16 @@ func isNamedParamSignCast(node ast.Node) bool { // "source" string representation (used for replacing this function call in the // original SQL query) func paramFromFuncCall(call *ast.FuncCall) (named.Param, string) { - paramName, isConst := flatten(call.Args) - - // origName keeps track of how the parameter was specified in the source SQL - origName := paramName - if isConst { - origName = fmt.Sprintf("'%s'", paramName) + type argField struct { + paramName string + isConst bool + } + args := make([]*argField, len(call.Args.Items)) + for i, a := range call.Args.Items { + args[i] = &argField{} + args[i].paramName, args[i].isConst = flatten(a) } + paramName := args[0].paramName var param named.Param switch call.Func.Name { @@ -61,6 +64,26 @@ func paramFromFuncCall(call *ast.FuncCall) (named.Param, string) { param = named.NewUserNullableParam(paramName) case "slice": param = named.NewSqlcSlice(paramName) + case "sort": + opts := map[string]interface{}{} + orderOpts := map[string]interface{}{} + orderParamName := "" + if len(args) > 1 { + for i, a := range args[1:] { + switch i { + case 0: + orderParamName = a.paramName + case 1: + opts[named.OptDefaultOrderFieldParam] = a.paramName + case 2: + orderOpts[named.OptDefaultOrderDirParam] = a.paramName + } + } + } + if orderParamName != "" { + opts[named.OptOrderDirParam] = named.NewSqlcSortOrder(orderParamName, orderOpts) + } + param = named.NewSqlcSort(paramName, opts) default: param = named.NewParam(paramName) } @@ -70,15 +93,34 @@ func paramFromFuncCall(call *ast.FuncCall) (named.Param, string) { // except between the function name and argument funcName := call.Func.Schema + "." + call.Func.Name spaces := "" + argsList := "" if call.Args != nil && len(call.Args.Items) > 0 { leftParen := call.Args.Items[0].Pos() - 1 spaces = strings.Repeat(" ", leftParen-call.Location-len(funcName)) + argPos := leftParen + 1 + for i := range call.Args.Items { + if i > 0 { + argSpaces := "," + strings.Repeat(" ", call.Args.Items[i].Pos()-argPos-1) + argsList += argSpaces + argPos += len(argSpaces) + } + argName := args[i].paramName + if args[i].isConst { + argName = fmt.Sprintf("'%s'", argName) + } + argsList += argName + argPos += len(argName) + } } - origText := fmt.Sprintf("%s%s(%s)", funcName, spaces, origName) + origText := fmt.Sprintf("%s%s(%s)", funcName, spaces, argsList) return param, origText } -func NamedParameters(engine config.Engine, raw *ast.RawStmt, numbs map[int]bool, dollar bool) (*ast.RawStmt, *named.ParamSet, []source.Edit) { +func NamedParameters(engine config.Engine, raw *ast.RawStmt, numbs map[int]bool, dollar bool) ( + *ast.RawStmt, + *named.ParamSet, + []source.Edit, +) { foundFunc := astutils.Search(raw, named.IsParamFunc) foundSign := astutils.Search(raw, named.IsParamSign) hasNamedParameterSupport := engine != config.EngineMySQL @@ -89,104 +131,149 @@ func NamedParameters(engine config.Engine, raw *ast.RawStmt, numbs map[int]bool, } var edits []source.Edit - node := astutils.Apply(raw, func(cr *astutils.Cursor) bool { - node := cr.Node() - switch { - case named.IsParamFunc(node): - fun := node.(*ast.FuncCall) - param, origText := paramFromFuncCall(fun) - argn := allParams.Add(param) - cr.Replace(&ast.ParamRef{ - Number: argn, - Location: fun.Location, - }) - - var replace string - if engine == config.EngineMySQL || engine == config.EngineSQLite || !dollar { - if param.IsSqlcSlice() { - // This sequence is also replicated in internal/codegen/golang.Field - // since it's needed during template generation for replacement - replace = fmt.Sprintf(`/*SLICE:%s*/?`, param.Name()) - } else { - if engine == config.EngineSQLite { - replace = fmt.Sprintf("?%d", argn) + node := astutils.Apply( + raw, func(cr *astutils.Cursor) bool { + node := cr.Node() + switch { + case named.IsParamFunc(node): + fun := node.(*ast.FuncCall) + param, origText := paramFromFuncCall(fun) + argn := allParams.Add(param) + ref := &ast.ParamRef{ + Number: argn, + Location: fun.Location, + } + cr.Replace(ref) + + var replace string + if engine == config.EngineMySQL || engine == config.EngineSQLite || !dollar { + if param.IsSqlcSlice() { + // This sequence is also replicated in internal/codegen/golang.Field + // since it's needed during template generation for replacement + replace = fmt.Sprintf(`/*SLICE:%s*/?`, param.Name()) + } else if param.IsSqlcSort() { + paramOpts := make([]string, 3) + var ( + orderParam named.Param + defSortField, defSortOrder string + ) + if opt, ok := param.GetOpt(named.OptOrderDirParam); ok { + orderParam = opt.(named.Param) + paramOpts[0] = orderParam.Name() + argn = allParams.Add(opt.(named.Param)) + cr.Replace( + &ast.List{ + Items: []ast.Node{ + ref, + &ast.ParamRef{ + Number: argn, + Location: fun.Location + 1, + }, + }, + }, + ) + if oOpt, oOk := orderParam.GetOpt(named.OptDefaultOrderDirParam); oOk { + paramOpts[2] = oOpt.(string) + defSortOrder = oOpt.(string) + } + } + if opt, ok := param.GetOpt(named.OptDefaultOrderFieldParam); ok { + paramOpts[1] = opt.(string) + defSortField = opt.(string) + } + replace = fmt.Sprintf(`/*SORT:%s:%s*/?`, param.Name(), defSortField) + if orderParam.Name() != "" { + replace += fmt.Sprintf(` /*ORDER:%s:%s*/`, orderParam.Name(), defSortOrder) + } } else { - replace = "?" + if engine == config.EngineSQLite { + replace = fmt.Sprintf("?%d", argn) + } else { + replace = "?" + } } + } else { + replace = fmt.Sprintf("$%d", argn) } - } else { - replace = fmt.Sprintf("$%d", argn) - } - edits = append(edits, source.Edit{ - Location: fun.Location - raw.StmtLocation, - Old: origText, - New: replace, - }) - return false - - case isNamedParamSignCast(node): - expr := node.(*ast.A_Expr) - cast := expr.Rexpr.(*ast.TypeCast) - paramName, _ := flatten(cast.Arg) - param := named.NewParam(paramName) - - argn := allParams.Add(param) - cast.Arg = &ast.ParamRef{ - Number: argn, - Location: expr.Location, - } - cr.Replace(cast) - - // TODO: This code assumes that @foo::bool is on a single line - var replace string - if engine == config.EngineMySQL || !dollar { - replace = "?" - } else if engine == config.EngineSQLite { - replace = fmt.Sprintf("?%d", argn) - } else { - replace = fmt.Sprintf("$%d", argn) - } + edits = append( + edits, source.Edit{ + Location: fun.Location - raw.StmtLocation, + Old: origText, + New: replace, + }, + ) + return false - edits = append(edits, source.Edit{ - Location: expr.Location - raw.StmtLocation, - Old: fmt.Sprintf("@%s", paramName), - New: replace, - }) - return false - - case named.IsParamSign(node): - expr := node.(*ast.A_Expr) - paramName, _ := flatten(expr.Rexpr) - param := named.NewParam(paramName) - - argn := allParams.Add(param) - cr.Replace(&ast.ParamRef{ - Number: argn, - Location: expr.Location, - }) - - // TODO: This code assumes that @foo is on a single line - var replace string - if engine == config.EngineMySQL || !dollar { - replace = "?" - } else if engine == config.EngineSQLite { - replace = fmt.Sprintf("?%d", argn) - } else { - replace = fmt.Sprintf("$%d", argn) - } + case isNamedParamSignCast(node): + expr := node.(*ast.A_Expr) + cast := expr.Rexpr.(*ast.TypeCast) + paramName, _ := flatten(cast.Arg) + param := named.NewParam(paramName) - edits = append(edits, source.Edit{ - Location: expr.Location - raw.StmtLocation, - Old: fmt.Sprintf("@%s", paramName), - New: replace, - }) - return false + argn := allParams.Add(param) + cast.Arg = &ast.ParamRef{ + Number: argn, + Location: expr.Location, + } + cr.Replace(cast) - default: - return true - } - }, nil) + // TODO: This code assumes that @foo::bool is on a single line + var replace string + if engine == config.EngineMySQL || !dollar { + replace = "?" + } else if engine == config.EngineSQLite { + replace = fmt.Sprintf("?%d", argn) + } else { + replace = fmt.Sprintf("$%d", argn) + } + + edits = append( + edits, source.Edit{ + Location: expr.Location - raw.StmtLocation, + Old: fmt.Sprintf("@%s", paramName), + New: replace, + }, + ) + return false + + case named.IsParamSign(node): + expr := node.(*ast.A_Expr) + paramName, _ := flatten(expr.Rexpr) + param := named.NewParam(paramName) + + argn := allParams.Add(param) + cr.Replace( + &ast.ParamRef{ + Number: argn, + Location: expr.Location, + }, + ) + + // TODO: This code assumes that @foo is on a single line + var replace string + if engine == config.EngineMySQL || !dollar { + replace = "?" + } else if engine == config.EngineSQLite { + replace = fmt.Sprintf("?%d", argn) + } else { + replace = fmt.Sprintf("$%d", argn) + } + + edits = append( + edits, source.Edit{ + Location: expr.Location - raw.StmtLocation, + Old: fmt.Sprintf("@%s", paramName), + New: replace, + }, + ) + return false + + default: + return true + } + }, nil, + ) return node.(*ast.RawStmt), allParams, edits } diff --git a/internal/sql/validate/param_style.go b/internal/sql/validate/param_style.go index 1182051d20..638329e7af 100644 --- a/internal/sql/validate/param_style.go +++ b/internal/sql/validate/param_style.go @@ -2,6 +2,7 @@ package validate import ( "fmt" + "strconv" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" @@ -29,14 +30,27 @@ func (v *sqlcFuncVisitor) Visit(node ast.Node) astutils.Visitor { // Custom validation for sqlc.arg, sqlc.narg and sqlc.slice // TODO: Replace this once type-checking is implemented if fn.Schema == "sqlc" { - if !(fn.Name == "arg" || fn.Name == "narg" || fn.Name == "slice" || fn.Name == "embed") { + if !(fn.Name == "arg" || fn.Name == "narg" || fn.Name == "slice" || fn.Name == "embed" || fn.Name == "sort") { v.err = sqlerr.FunctionNotFound("sqlc." + fn.Name) return nil } - if len(call.Args.Items) != 1 { + minArgs := 1 + maxArgs := 1 + if fn.Name == "sort" { + maxArgs = 4 + } + if len(call.Args.Items) > maxArgs || len(call.Args.Items) < minArgs { + expectedNumArgs := strconv.Itoa(minArgs) + if maxArgs != minArgs { + expectedNumArgs += "-" + strconv.Itoa(maxArgs) + } + expectedNumArgs += " parameter" + if maxArgs != minArgs { + expectedNumArgs += "s" + } v.err = &sqlerr.Error{ - Message: fmt.Sprintf("expected 1 parameter to sqlc.%s; got %d", fn.Name, len(call.Args.Items)), + Message: fmt.Sprintf("expected %s to sqlc.%s; got %d", expectedNumArgs, fn.Name, len(call.Args.Items)), Location: call.Pos(), } return nil diff --git a/internal/vet/vet.pb.go b/internal/vet/vet.pb.go index b40f109c10..915cd32632 100644 --- a/internal/vet/vet.pb.go +++ b/internal/vet/vet.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.36.1 // protoc (unknown) // source: vet/vet.proto @@ -21,20 +21,17 @@ const ( ) type Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` unknownFields protoimpl.UnknownFields - - Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Parameter) Reset() { *x = Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Parameter) String() string { @@ -45,7 +42,7 @@ func (*Parameter) ProtoMessage() {} func (x *Parameter) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -68,23 +65,20 @@ func (x *Parameter) GetNumber() int32 { } type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` + Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` + Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` unknownFields protoimpl.UnknownFields - - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` - Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` - Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Config) String() string { @@ -95,7 +89,7 @@ func (*Config) ProtoMessage() {} func (x *Config) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -139,23 +133,20 @@ func (x *Config) GetQueries() []string { } type Query struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Sql string `protobuf:"bytes,1,opt,name=sql,proto3" json:"sql,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` + Params []*Parameter `protobuf:"bytes,4,rep,name=params,json=parameters,proto3" json:"params,omitempty"` unknownFields protoimpl.UnknownFields - - Sql string `protobuf:"bytes,1,opt,name=sql,proto3" json:"sql,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` - Params []*Parameter `protobuf:"bytes,4,rep,name=params,json=parameters,proto3" json:"params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Query) Reset() { *x = Query{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Query) String() string { @@ -166,7 +157,7 @@ func (*Query) ProtoMessage() {} func (x *Query) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -210,20 +201,17 @@ func (x *Query) GetParams() []*Parameter { } type PostgreSQL struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Explain *PostgreSQLExplain `protobuf:"bytes,1,opt,name=explain,proto3" json:"explain,omitempty"` unknownFields protoimpl.UnknownFields - - Explain *PostgreSQLExplain `protobuf:"bytes,1,opt,name=explain,proto3" json:"explain,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PostgreSQL) Reset() { *x = PostgreSQL{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PostgreSQL) String() string { @@ -234,7 +222,7 @@ func (*PostgreSQL) ProtoMessage() {} func (x *PostgreSQL) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -257,22 +245,19 @@ func (x *PostgreSQL) GetExplain() *PostgreSQLExplain { } type PostgreSQLExplain struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Plan *PostgreSQLExplain_Plan `protobuf:"bytes,1,opt,name=plan,json=Plan,proto3" json:"plan,omitempty"` + Settings map[string]string `protobuf:"bytes,2,rep,name=settings,json=Settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Planning *PostgreSQLExplain_Planning `protobuf:"bytes,3,opt,name=planning,json=Planning,proto3" json:"planning,omitempty"` unknownFields protoimpl.UnknownFields - - Plan *PostgreSQLExplain_Plan `protobuf:"bytes,1,opt,name=plan,json=Plan,proto3" json:"plan,omitempty"` - Settings map[string]string `protobuf:"bytes,2,rep,name=settings,json=Settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Planning *PostgreSQLExplain_Planning `protobuf:"bytes,3,opt,name=planning,json=Planning,proto3" json:"planning,omitempty"` + sizeCache protoimpl.SizeCache } func (x *PostgreSQLExplain) Reset() { *x = PostgreSQLExplain{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PostgreSQLExplain) String() string { @@ -283,7 +268,7 @@ func (*PostgreSQLExplain) ProtoMessage() {} func (x *PostgreSQLExplain) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -320,20 +305,17 @@ func (x *PostgreSQLExplain) GetPlanning() *PostgreSQLExplain_Planning { } type MySQL struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Explain *MySQLExplain `protobuf:"bytes,1,opt,name=explain,proto3" json:"explain,omitempty"` unknownFields protoimpl.UnknownFields - - Explain *MySQLExplain `protobuf:"bytes,1,opt,name=explain,proto3" json:"explain,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MySQL) Reset() { *x = MySQL{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MySQL) String() string { @@ -344,7 +326,7 @@ func (*MySQL) ProtoMessage() {} func (x *MySQL) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -367,20 +349,17 @@ func (x *MySQL) GetExplain() *MySQLExplain { } type MySQLExplain struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + QueryBlock *MySQLExplain_QueryBlock `protobuf:"bytes,1,opt,name=query_block,json=queryBlock,proto3" json:"query_block,omitempty"` unknownFields protoimpl.UnknownFields - - QueryBlock *MySQLExplain_QueryBlock `protobuf:"bytes,1,opt,name=query_block,json=queryBlock,proto3" json:"query_block,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MySQLExplain) Reset() { *x = MySQLExplain{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MySQLExplain) String() string { @@ -391,7 +370,7 @@ func (*MySQLExplain) ProtoMessage() {} func (x *MySQLExplain) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -414,10 +393,7 @@ func (x *MySQLExplain) GetQueryBlock() *MySQLExplain_QueryBlock { } type PostgreSQLExplain_Plan struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` NodeType string `protobuf:"bytes,1,opt,name=node_type,json=Node Type,proto3" json:"node_type,omitempty"` ParentRelationship string `protobuf:"bytes,2,opt,name=parent_relationship,json=Parent Relationship,proto3" json:"parent_relationship,omitempty"` RelationName string `protobuf:"bytes,3,opt,name=relation_name,json=Relation Name,proto3" json:"relation_name,omitempty"` @@ -452,15 +428,15 @@ type PostgreSQLExplain_Plan struct { IndexName string `protobuf:"bytes,28,opt,name=index_name,json=Index Name,proto3" json:"index_name,omitempty"` ScanDirection string `protobuf:"bytes,29,opt,name=scan_direction,json=Scan Direction,proto3" json:"scan_direction,omitempty"` IndexCond string `protobuf:"bytes,30,opt,name=index_cond,json=Index Cond,proto3" json:"index_cond,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PostgreSQLExplain_Plan) Reset() { *x = PostgreSQLExplain_Plan{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PostgreSQLExplain_Plan) String() string { @@ -471,7 +447,7 @@ func (*PostgreSQLExplain_Plan) ProtoMessage() {} func (x *PostgreSQLExplain_Plan) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -697,29 +673,26 @@ func (x *PostgreSQLExplain_Plan) GetIndexCond() string { } type PostgreSQLExplain_Planning struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SharedHitBlocks uint64 `protobuf:"varint,1,opt,name=shared_hit_blocks,json=Shared Hit Blocks,proto3" json:"shared_hit_blocks,omitempty"` - SharedReadBlocks uint64 `protobuf:"varint,2,opt,name=shared_read_blocks,json=Shared Read Blocks,proto3" json:"shared_read_blocks,omitempty"` - SharedDirtiedBlocks uint64 `protobuf:"varint,3,opt,name=shared_dirtied_blocks,json=Shared Dirtied Blocks,proto3" json:"shared_dirtied_blocks,omitempty"` - SharedWrittenBlocks uint64 `protobuf:"varint,4,opt,name=shared_written_blocks,json=Shared Written Blocks,proto3" json:"shared_written_blocks,omitempty"` - LocalHitBlocks uint64 `protobuf:"varint,5,opt,name=local_hit_blocks,json=Local Hit Blocks,proto3" json:"local_hit_blocks,omitempty"` - LocalReadBlocks uint64 `protobuf:"varint,6,opt,name=local_read_blocks,json=Local Read Blocks,proto3" json:"local_read_blocks,omitempty"` - LocalDirtiedBlocks uint64 `protobuf:"varint,7,opt,name=local_dirtied_blocks,json=Local Dirtied Blocks,proto3" json:"local_dirtied_blocks,omitempty"` - LocalWrittenBlocks uint64 `protobuf:"varint,8,opt,name=local_written_blocks,json=Local Written Blocks,proto3" json:"local_written_blocks,omitempty"` - TempReadBlocks uint64 `protobuf:"varint,9,opt,name=temp_read_blocks,json=Temp Read Blocks,proto3" json:"temp_read_blocks,omitempty"` - TempWrittenBlocks uint64 `protobuf:"varint,10,opt,name=temp_written_blocks,json=Temp Written Blocks,proto3" json:"temp_written_blocks,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + SharedHitBlocks uint64 `protobuf:"varint,1,opt,name=shared_hit_blocks,json=Shared Hit Blocks,proto3" json:"shared_hit_blocks,omitempty"` + SharedReadBlocks uint64 `protobuf:"varint,2,opt,name=shared_read_blocks,json=Shared Read Blocks,proto3" json:"shared_read_blocks,omitempty"` + SharedDirtiedBlocks uint64 `protobuf:"varint,3,opt,name=shared_dirtied_blocks,json=Shared Dirtied Blocks,proto3" json:"shared_dirtied_blocks,omitempty"` + SharedWrittenBlocks uint64 `protobuf:"varint,4,opt,name=shared_written_blocks,json=Shared Written Blocks,proto3" json:"shared_written_blocks,omitempty"` + LocalHitBlocks uint64 `protobuf:"varint,5,opt,name=local_hit_blocks,json=Local Hit Blocks,proto3" json:"local_hit_blocks,omitempty"` + LocalReadBlocks uint64 `protobuf:"varint,6,opt,name=local_read_blocks,json=Local Read Blocks,proto3" json:"local_read_blocks,omitempty"` + LocalDirtiedBlocks uint64 `protobuf:"varint,7,opt,name=local_dirtied_blocks,json=Local Dirtied Blocks,proto3" json:"local_dirtied_blocks,omitempty"` + LocalWrittenBlocks uint64 `protobuf:"varint,8,opt,name=local_written_blocks,json=Local Written Blocks,proto3" json:"local_written_blocks,omitempty"` + TempReadBlocks uint64 `protobuf:"varint,9,opt,name=temp_read_blocks,json=Temp Read Blocks,proto3" json:"temp_read_blocks,omitempty"` + TempWrittenBlocks uint64 `protobuf:"varint,10,opt,name=temp_written_blocks,json=Temp Written Blocks,proto3" json:"temp_written_blocks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PostgreSQLExplain_Planning) Reset() { *x = PostgreSQLExplain_Planning{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *PostgreSQLExplain_Planning) String() string { @@ -730,7 +703,7 @@ func (*PostgreSQLExplain_Planning) ProtoMessage() {} func (x *PostgreSQLExplain_Planning) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -816,25 +789,22 @@ func (x *PostgreSQLExplain_Planning) GetTempWrittenBlocks() uint64 { } type MySQLExplain_QueryBlock struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` SelectId uint64 `protobuf:"varint,1,opt,name=select_id,json=selectId,proto3" json:"select_id,omitempty"` Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - CostInfo map[string]string `protobuf:"bytes,3,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + CostInfo map[string]string `protobuf:"bytes,3,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` Table *MySQLExplain_Table `protobuf:"bytes,4,opt,name=table,proto3" json:"table,omitempty"` OrderingOperation *MySQLExplain_OrderingOperation `protobuf:"bytes,5,opt,name=ordering_operation,json=orderingOperation,proto3" json:"ordering_operation,omitempty"` NestedLoop []*MySQLExplain_NestedLoopObj `protobuf:"bytes,6,rep,name=nested_loop,json=nestedLoop,proto3" json:"nested_loop,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *MySQLExplain_QueryBlock) Reset() { *x = MySQLExplain_QueryBlock{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MySQLExplain_QueryBlock) String() string { @@ -845,7 +815,7 @@ func (*MySQLExplain_QueryBlock) ProtoMessage() {} func (x *MySQLExplain_QueryBlock) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -903,32 +873,29 @@ func (x *MySQLExplain_QueryBlock) GetNestedLoop() []*MySQLExplain_NestedLoopObj } type MySQLExplain_Table struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` - AccessType string `protobuf:"bytes,2,opt,name=access_type,json=accessType,proto3" json:"access_type,omitempty"` - RowsExaminedPerScan uint64 `protobuf:"varint,3,opt,name=rows_examined_per_scan,json=rowsExaminedPerScan,proto3" json:"rows_examined_per_scan,omitempty"` - RowsProducedPerJoin uint64 `protobuf:"varint,4,opt,name=rows_produced_per_join,json=rowsProducedPerJoin,proto3" json:"rows_produced_per_join,omitempty"` - Filtered string `protobuf:"bytes,5,opt,name=filtered,proto3" json:"filtered,omitempty"` - CostInfo map[string]string `protobuf:"bytes,6,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - UsedColumns []string `protobuf:"bytes,7,rep,name=used_columns,json=usedColumns,proto3" json:"used_columns,omitempty"` - Insert bool `protobuf:"varint,8,opt,name=insert,proto3" json:"insert,omitempty"` - PossibleKeys []string `protobuf:"bytes,9,rep,name=possible_keys,json=possibleKeys,proto3" json:"possible_keys,omitempty"` - Key string `protobuf:"bytes,10,opt,name=key,proto3" json:"key,omitempty"` - UsedKeyParts []string `protobuf:"bytes,11,rep,name=used_key_parts,json=usedKeyParts,proto3" json:"used_key_parts,omitempty"` - KeyLength string `protobuf:"bytes,12,opt,name=key_length,json=keyLength,proto3" json:"key_length,omitempty"` - Ref []string `protobuf:"bytes,13,rep,name=ref,proto3" json:"ref,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + AccessType string `protobuf:"bytes,2,opt,name=access_type,json=accessType,proto3" json:"access_type,omitempty"` + RowsExaminedPerScan uint64 `protobuf:"varint,3,opt,name=rows_examined_per_scan,json=rowsExaminedPerScan,proto3" json:"rows_examined_per_scan,omitempty"` + RowsProducedPerJoin uint64 `protobuf:"varint,4,opt,name=rows_produced_per_join,json=rowsProducedPerJoin,proto3" json:"rows_produced_per_join,omitempty"` + Filtered string `protobuf:"bytes,5,opt,name=filtered,proto3" json:"filtered,omitempty"` + CostInfo map[string]string `protobuf:"bytes,6,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + UsedColumns []string `protobuf:"bytes,7,rep,name=used_columns,json=usedColumns,proto3" json:"used_columns,omitempty"` + Insert bool `protobuf:"varint,8,opt,name=insert,proto3" json:"insert,omitempty"` + PossibleKeys []string `protobuf:"bytes,9,rep,name=possible_keys,json=possibleKeys,proto3" json:"possible_keys,omitempty"` + Key string `protobuf:"bytes,10,opt,name=key,proto3" json:"key,omitempty"` + UsedKeyParts []string `protobuf:"bytes,11,rep,name=used_key_parts,json=usedKeyParts,proto3" json:"used_key_parts,omitempty"` + KeyLength string `protobuf:"bytes,12,opt,name=key_length,json=keyLength,proto3" json:"key_length,omitempty"` + Ref []string `protobuf:"bytes,13,rep,name=ref,proto3" json:"ref,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *MySQLExplain_Table) Reset() { *x = MySQLExplain_Table{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MySQLExplain_Table) String() string { @@ -939,7 +906,7 @@ func (*MySQLExplain_Table) ProtoMessage() {} func (x *MySQLExplain_Table) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1046,20 +1013,17 @@ func (x *MySQLExplain_Table) GetRef() []string { } type MySQLExplain_NestedLoopObj struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Table *MySQLExplain_Table `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"` unknownFields protoimpl.UnknownFields - - Table *MySQLExplain_Table `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MySQLExplain_NestedLoopObj) Reset() { *x = MySQLExplain_NestedLoopObj{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MySQLExplain_NestedLoopObj) String() string { @@ -1070,7 +1034,7 @@ func (*MySQLExplain_NestedLoopObj) ProtoMessage() {} func (x *MySQLExplain_NestedLoopObj) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1093,23 +1057,20 @@ func (x *MySQLExplain_NestedLoopObj) GetTable() *MySQLExplain_Table { } type MySQLExplain_OrderingOperation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` UsingFilesort bool `protobuf:"varint,1,opt,name=using_filesort,json=usingFilesort,proto3" json:"using_filesort,omitempty"` - CostInfo map[string]string `protobuf:"bytes,2,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + CostInfo map[string]string `protobuf:"bytes,2,rep,name=cost_info,json=costInfo,proto3" json:"cost_info,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` Table *MySQLExplain_Table `protobuf:"bytes,3,opt,name=table,proto3" json:"table,omitempty"` NestedLoop []*MySQLExplain_NestedLoopObj `protobuf:"bytes,4,rep,name=nested_loop,json=nestedLoop,proto3" json:"nested_loop,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *MySQLExplain_OrderingOperation) Reset() { *x = MySQLExplain_OrderingOperation{} - if protoimpl.UnsafeEnabled { - mi := &file_vet_vet_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_vet_vet_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MySQLExplain_OrderingOperation) String() string { @@ -1120,7 +1081,7 @@ func (*MySQLExplain_OrderingOperation) ProtoMessage() {} func (x *MySQLExplain_OrderingOperation) ProtoReflect() protoreflect.Message { mi := &file_vet_vet_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1421,7 +1382,7 @@ func file_vet_vet_proto_rawDescGZIP() []byte { } var file_vet_vet_proto_msgTypes = make([]protoimpl.MessageInfo, 17) -var file_vet_vet_proto_goTypes = []interface{}{ +var file_vet_vet_proto_goTypes = []any{ (*Parameter)(nil), // 0: vet.Parameter (*Config)(nil), // 1: vet.Config (*Query)(nil), // 2: vet.Query @@ -1470,164 +1431,6 @@ func file_vet_vet_proto_init() { if File_vet_vet_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_vet_vet_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Query); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PostgreSQL); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PostgreSQLExplain); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MySQL); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MySQLExplain); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PostgreSQLExplain_Plan); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PostgreSQLExplain_Planning); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MySQLExplain_QueryBlock); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MySQLExplain_Table); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MySQLExplain_NestedLoopObj); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_vet_vet_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MySQLExplain_OrderingOperation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/protos/analysis/analysis.proto b/protos/analysis/analysis.proto index 60e53b56f1..0ec63b25b0 100644 --- a/protos/analysis/analysis.proto +++ b/protos/analysis/analysis.proto @@ -8,6 +8,12 @@ message Identifier { string name = 3; } +message SqlcSortOpts { + bool is_order = 1; + string default_field = 2; + string default_order = 3; +} + message Column { string name = 1; string original_name = 2; @@ -26,6 +32,7 @@ message Column { Identifier type = 15; Identifier embed_table = 16; bool is_sqlc_slice = 17; + optional SqlcSortOpts sqlc_sort_opts = 18; } message Parameter { diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index e6faf19bad..e88c867f18 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -81,6 +81,12 @@ message Identifier { string name = 3; } +message SqlcSortOpts { + bool is_order = 1; + string default_field = 2; + string default_order = 3; +} + message Column { string name = 1; bool not_null = 3; @@ -96,6 +102,7 @@ message Column { string table_alias = 11; Identifier type = 12; bool is_sqlc_slice = 13; + optional SqlcSortOpts sqlc_sort_opts = 18; Identifier embed_table = 14; string original_name = 15; bool unsigned = 16;