Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: no mybatis (#16947)

Danny Xu2343ba0ada32
diff --git a/backend/generated-go/v1/sql_service.pb.go b/backend/generated-go/v1/sql_service.pb.go
index 40d25ddd5e..0ffe9eb0c4 100644
--- a/backend/generated-go/v1/sql_service.pb.go
+++ b/backend/generated-go/v1/sql_service.pb.go
@@ -291,7 +291,7 @@ func (x QueryHistory_Type) Number() protoreflect.EnumNumber {
// Deprecated: Use QueryHistory_Type.Descriptor instead.
func (QueryHistory_Type) EnumDescriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{22, 0}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{20, 0}
}
type AdminExecuteRequest struct {
@@ -1665,94 +1665,6 @@ func (x *CheckResponse) GetAffectedRows() int32 {
return 0
}
-type ParseMyBatisMapperRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ParseMyBatisMapperRequest) Reset() {
- *x = ParseMyBatisMapperRequest{}
- mi := &file_v1_sql_service_proto_msgTypes[16]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ParseMyBatisMapperRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ParseMyBatisMapperRequest) ProtoMessage() {}
-
-func (x *ParseMyBatisMapperRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[16]
- 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 ParseMyBatisMapperRequest.ProtoReflect.Descriptor instead.
-func (*ParseMyBatisMapperRequest) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{16}
-}
-
-func (x *ParseMyBatisMapperRequest) GetContent() []byte {
- if x != nil {
- return x.Content
- }
- return nil
-}
-
-type ParseMyBatisMapperResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Statements []string `protobuf:"bytes,1,rep,name=statements,proto3" json:"statements,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ParseMyBatisMapperResponse) Reset() {
- *x = ParseMyBatisMapperResponse{}
- mi := &file_v1_sql_service_proto_msgTypes[17]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ParseMyBatisMapperResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ParseMyBatisMapperResponse) ProtoMessage() {}
-
-func (x *ParseMyBatisMapperResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[17]
- 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 ParseMyBatisMapperResponse.ProtoReflect.Descriptor instead.
-func (*ParseMyBatisMapperResponse) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{17}
-}
-
-func (x *ParseMyBatisMapperResponse) GetStatements() []string {
- if x != nil {
- return x.Statements
- }
- return nil
-}
-
type DiffMetadataRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The metadata of the source schema.
@@ -1772,7 +1684,7 @@ type DiffMetadataRequest struct {
func (x *DiffMetadataRequest) Reset() {
*x = DiffMetadataRequest{}
- mi := &file_v1_sql_service_proto_msgTypes[18]
+ mi := &file_v1_sql_service_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1784,7 +1696,7 @@ func (x *DiffMetadataRequest) String() string {
func (*DiffMetadataRequest) ProtoMessage() {}
func (x *DiffMetadataRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[18]
+ mi := &file_v1_sql_service_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1797,7 +1709,7 @@ func (x *DiffMetadataRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DiffMetadataRequest.ProtoReflect.Descriptor instead.
func (*DiffMetadataRequest) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{18}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{16}
}
func (x *DiffMetadataRequest) GetSourceMetadata() *DatabaseMetadata {
@@ -1852,7 +1764,7 @@ type DiffMetadataResponse struct {
func (x *DiffMetadataResponse) Reset() {
*x = DiffMetadataResponse{}
- mi := &file_v1_sql_service_proto_msgTypes[19]
+ mi := &file_v1_sql_service_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1864,7 +1776,7 @@ func (x *DiffMetadataResponse) String() string {
func (*DiffMetadataResponse) ProtoMessage() {}
func (x *DiffMetadataResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[19]
+ mi := &file_v1_sql_service_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1877,7 +1789,7 @@ func (x *DiffMetadataResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DiffMetadataResponse.ProtoReflect.Descriptor instead.
func (*DiffMetadataResponse) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{19}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{17}
}
func (x *DiffMetadataResponse) GetDiff() string {
@@ -1922,7 +1834,7 @@ type SearchQueryHistoriesRequest struct {
func (x *SearchQueryHistoriesRequest) Reset() {
*x = SearchQueryHistoriesRequest{}
- mi := &file_v1_sql_service_proto_msgTypes[20]
+ mi := &file_v1_sql_service_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1934,7 +1846,7 @@ func (x *SearchQueryHistoriesRequest) String() string {
func (*SearchQueryHistoriesRequest) ProtoMessage() {}
func (x *SearchQueryHistoriesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[20]
+ mi := &file_v1_sql_service_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1947,7 +1859,7 @@ func (x *SearchQueryHistoriesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchQueryHistoriesRequest.ProtoReflect.Descriptor instead.
func (*SearchQueryHistoriesRequest) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{20}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{18}
}
func (x *SearchQueryHistoriesRequest) GetPageSize() int32 {
@@ -1985,7 +1897,7 @@ type SearchQueryHistoriesResponse struct {
func (x *SearchQueryHistoriesResponse) Reset() {
*x = SearchQueryHistoriesResponse{}
- mi := &file_v1_sql_service_proto_msgTypes[21]
+ mi := &file_v1_sql_service_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1997,7 +1909,7 @@ func (x *SearchQueryHistoriesResponse) String() string {
func (*SearchQueryHistoriesResponse) ProtoMessage() {}
func (x *SearchQueryHistoriesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[21]
+ mi := &file_v1_sql_service_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2010,7 +1922,7 @@ func (x *SearchQueryHistoriesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchQueryHistoriesResponse.ProtoReflect.Descriptor instead.
func (*SearchQueryHistoriesResponse) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{21}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{19}
}
func (x *SearchQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {
@@ -2047,7 +1959,7 @@ type QueryHistory struct {
func (x *QueryHistory) Reset() {
*x = QueryHistory{}
- mi := &file_v1_sql_service_proto_msgTypes[22]
+ mi := &file_v1_sql_service_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2059,7 +1971,7 @@ func (x *QueryHistory) String() string {
func (*QueryHistory) ProtoMessage() {}
func (x *QueryHistory) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[22]
+ mi := &file_v1_sql_service_proto_msgTypes[20]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2072,7 +1984,7 @@ func (x *QueryHistory) ProtoReflect() protoreflect.Message {
// Deprecated: Use QueryHistory.ProtoReflect.Descriptor instead.
func (*QueryHistory) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{22}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{20}
}
func (x *QueryHistory) GetName() string {
@@ -2140,7 +2052,7 @@ type AICompletionRequest struct {
func (x *AICompletionRequest) Reset() {
*x = AICompletionRequest{}
- mi := &file_v1_sql_service_proto_msgTypes[23]
+ mi := &file_v1_sql_service_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2152,7 +2064,7 @@ func (x *AICompletionRequest) String() string {
func (*AICompletionRequest) ProtoMessage() {}
func (x *AICompletionRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[23]
+ mi := &file_v1_sql_service_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2165,7 +2077,7 @@ func (x *AICompletionRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use AICompletionRequest.ProtoReflect.Descriptor instead.
func (*AICompletionRequest) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{23}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{21}
}
func (x *AICompletionRequest) GetMessages() []*AICompletionRequest_Message {
@@ -2186,7 +2098,7 @@ type AICompletionResponse struct {
func (x *AICompletionResponse) Reset() {
*x = AICompletionResponse{}
- mi := &file_v1_sql_service_proto_msgTypes[24]
+ mi := &file_v1_sql_service_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2198,7 +2110,7 @@ func (x *AICompletionResponse) String() string {
func (*AICompletionResponse) ProtoMessage() {}
func (x *AICompletionResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[24]
+ mi := &file_v1_sql_service_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2211,7 +2123,7 @@ func (x *AICompletionResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use AICompletionResponse.ProtoReflect.Descriptor instead.
func (*AICompletionResponse) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{24}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{22}
}
func (x *AICompletionResponse) GetCandidates() []*AICompletionResponse_Candidate {
@@ -2248,7 +2160,7 @@ type QueryResult_PostgresError struct {
func (x *QueryResult_PostgresError) Reset() {
*x = QueryResult_PostgresError{}
- mi := &file_v1_sql_service_proto_msgTypes[25]
+ mi := &file_v1_sql_service_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2260,7 +2172,7 @@ func (x *QueryResult_PostgresError) String() string {
func (*QueryResult_PostgresError) ProtoMessage() {}
func (x *QueryResult_PostgresError) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[25]
+ mi := &file_v1_sql_service_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2405,7 +2317,7 @@ type QueryResult_Message struct {
func (x *QueryResult_Message) Reset() {
*x = QueryResult_Message{}
- mi := &file_v1_sql_service_proto_msgTypes[26]
+ mi := &file_v1_sql_service_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2417,7 +2329,7 @@ func (x *QueryResult_Message) String() string {
func (*QueryResult_Message) ProtoMessage() {}
func (x *QueryResult_Message) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[26]
+ mi := &file_v1_sql_service_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2458,7 +2370,7 @@ type RowValue_Timestamp struct {
func (x *RowValue_Timestamp) Reset() {
*x = RowValue_Timestamp{}
- mi := &file_v1_sql_service_proto_msgTypes[27]
+ mi := &file_v1_sql_service_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2470,7 +2382,7 @@ func (x *RowValue_Timestamp) String() string {
func (*RowValue_Timestamp) ProtoMessage() {}
func (x *RowValue_Timestamp) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[27]
+ mi := &file_v1_sql_service_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2519,7 +2431,7 @@ type RowValue_TimestampTZ struct {
func (x *RowValue_TimestampTZ) Reset() {
*x = RowValue_TimestampTZ{}
- mi := &file_v1_sql_service_proto_msgTypes[28]
+ mi := &file_v1_sql_service_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2531,7 +2443,7 @@ func (x *RowValue_TimestampTZ) String() string {
func (*RowValue_TimestampTZ) ProtoMessage() {}
func (x *RowValue_TimestampTZ) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[28]
+ mi := &file_v1_sql_service_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2585,7 +2497,7 @@ type AICompletionRequest_Message struct {
func (x *AICompletionRequest_Message) Reset() {
*x = AICompletionRequest_Message{}
- mi := &file_v1_sql_service_proto_msgTypes[29]
+ mi := &file_v1_sql_service_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2597,7 +2509,7 @@ func (x *AICompletionRequest_Message) String() string {
func (*AICompletionRequest_Message) ProtoMessage() {}
func (x *AICompletionRequest_Message) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[29]
+ mi := &file_v1_sql_service_proto_msgTypes[27]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2610,7 +2522,7 @@ func (x *AICompletionRequest_Message) ProtoReflect() protoreflect.Message {
// Deprecated: Use AICompletionRequest_Message.ProtoReflect.Descriptor instead.
func (*AICompletionRequest_Message) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{23, 0}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{21, 0}
}
func (x *AICompletionRequest_Message) GetRole() string {
@@ -2636,7 +2548,7 @@ type AICompletionResponse_Candidate struct {
func (x *AICompletionResponse_Candidate) Reset() {
*x = AICompletionResponse_Candidate{}
- mi := &file_v1_sql_service_proto_msgTypes[30]
+ mi := &file_v1_sql_service_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2648,7 +2560,7 @@ func (x *AICompletionResponse_Candidate) String() string {
func (*AICompletionResponse_Candidate) ProtoMessage() {}
func (x *AICompletionResponse_Candidate) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[30]
+ mi := &file_v1_sql_service_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2661,7 +2573,7 @@ func (x *AICompletionResponse_Candidate) ProtoReflect() protoreflect.Message {
// Deprecated: Use AICompletionResponse_Candidate.ProtoReflect.Descriptor instead.
func (*AICompletionResponse_Candidate) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{24, 0}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{22, 0}
}
func (x *AICompletionResponse_Candidate) GetContent() *AICompletionResponse_Candidate_Content {
@@ -2681,7 +2593,7 @@ type AICompletionResponse_Candidate_Content struct {
func (x *AICompletionResponse_Candidate_Content) Reset() {
*x = AICompletionResponse_Candidate_Content{}
- mi := &file_v1_sql_service_proto_msgTypes[31]
+ mi := &file_v1_sql_service_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2693,7 +2605,7 @@ func (x *AICompletionResponse_Candidate_Content) String() string {
func (*AICompletionResponse_Candidate_Content) ProtoMessage() {}
func (x *AICompletionResponse_Candidate_Content) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[31]
+ mi := &file_v1_sql_service_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2706,7 +2618,7 @@ func (x *AICompletionResponse_Candidate_Content) ProtoReflect() protoreflect.Mes
// Deprecated: Use AICompletionResponse_Candidate_Content.ProtoReflect.Descriptor instead.
func (*AICompletionResponse_Candidate_Content) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{24, 0, 0}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{22, 0, 0}
}
func (x *AICompletionResponse_Candidate_Content) GetParts() []*AICompletionResponse_Candidate_Content_Part {
@@ -2725,7 +2637,7 @@ type AICompletionResponse_Candidate_Content_Part struct {
func (x *AICompletionResponse_Candidate_Content_Part) Reset() {
*x = AICompletionResponse_Candidate_Content_Part{}
- mi := &file_v1_sql_service_proto_msgTypes[32]
+ mi := &file_v1_sql_service_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2737,7 +2649,7 @@ func (x *AICompletionResponse_Candidate_Content_Part) String() string {
func (*AICompletionResponse_Candidate_Content_Part) ProtoMessage() {}
func (x *AICompletionResponse_Candidate_Content_Part) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sql_service_proto_msgTypes[32]
+ mi := &file_v1_sql_service_proto_msgTypes[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2750,7 +2662,7 @@ func (x *AICompletionResponse_Candidate_Content_Part) ProtoReflect() protoreflec
// Deprecated: Use AICompletionResponse_Candidate_Content_Part.ProtoReflect.Descriptor instead.
func (*AICompletionResponse_Candidate_Content_Part) Descriptor() ([]byte, []int) {
- return file_v1_sql_service_proto_rawDescGZIP(), []int{24, 0, 0, 0}
+ return file_v1_sql_service_proto_rawDescGZIP(), []int{22, 0, 0, 0}
}
func (x *AICompletionResponse_Candidate_Content_Part) GetText() string {
@@ -2935,13 +2847,7 @@ const file_v1_sql_service_proto_rawDesc = "" +
"SQL_EDITOR\x10\x04\"c\n" +
"\rCheckResponse\x12-\n" +
"\aadvices\x18\x01 \x03(\v2\x13.bytebase.v1.AdviceR\aadvices\x12#\n" +
- "\raffected_rows\x18\x02 \x01(\x05R\faffectedRows\"5\n" +
- "\x19ParseMyBatisMapperRequest\x12\x18\n" +
- "\acontent\x18\x01 \x01(\fR\acontent\"<\n" +
- "\x1aParseMyBatisMapperResponse\x12\x1e\n" +
- "\n" +
- "statements\x18\x01 \x03(\tR\n" +
- "statements\"\xa4\x03\n" +
+ "\raffected_rows\x18\x02 \x01(\x05R\faffectedRows\"\xa4\x03\n" +
"\x13DiffMetadataRequest\x12K\n" +
"\x0fsource_metadata\x18\x01 \x01(\v2\x1d.bytebase.v1.DatabaseMetadataB\x03\xe0A\x02R\x0esourceMetadata\x12K\n" +
"\x0ftarget_metadata\x18\x02 \x01(\v2\x1d.bytebase.v1.DatabaseMetadataB\x03\xe0A\x02R\x0etargetMetadata\x12C\n" +
@@ -3014,7 +2920,7 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {
}
var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
-var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 33)
+var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 31)
var file_v1_sql_service_proto_goTypes = []any{
(QueryOption_RedisRunCommandsOn)(0), // 0: bytebase.v1.QueryOption.RedisRunCommandsOn
(QueryResult_Message_Level)(0), // 1: bytebase.v1.QueryResult.Message.Level
@@ -3037,32 +2943,30 @@ var file_v1_sql_service_proto_goTypes = []any{
(*PrettyResponse)(nil), // 18: bytebase.v1.PrettyResponse
(*CheckRequest)(nil), // 19: bytebase.v1.CheckRequest
(*CheckResponse)(nil), // 20: bytebase.v1.CheckResponse
- (*ParseMyBatisMapperRequest)(nil), // 21: bytebase.v1.ParseMyBatisMapperRequest
- (*ParseMyBatisMapperResponse)(nil), // 22: bytebase.v1.ParseMyBatisMapperResponse
- (*DiffMetadataRequest)(nil), // 23: bytebase.v1.DiffMetadataRequest
- (*DiffMetadataResponse)(nil), // 24: bytebase.v1.DiffMetadataResponse
- (*SearchQueryHistoriesRequest)(nil), // 25: bytebase.v1.SearchQueryHistoriesRequest
- (*SearchQueryHistoriesResponse)(nil), // 26: bytebase.v1.SearchQueryHistoriesResponse
- (*QueryHistory)(nil), // 27: bytebase.v1.QueryHistory
- (*AICompletionRequest)(nil), // 28: bytebase.v1.AICompletionRequest
- (*AICompletionResponse)(nil), // 29: bytebase.v1.AICompletionResponse
- (*QueryResult_PostgresError)(nil), // 30: bytebase.v1.QueryResult.PostgresError
- (*QueryResult_Message)(nil), // 31: bytebase.v1.QueryResult.Message
- (*RowValue_Timestamp)(nil), // 32: bytebase.v1.RowValue.Timestamp
- (*RowValue_TimestampTZ)(nil), // 33: bytebase.v1.RowValue.TimestampTZ
- (*AICompletionRequest_Message)(nil), // 34: bytebase.v1.AICompletionRequest.Message
- (*AICompletionResponse_Candidate)(nil), // 35: bytebase.v1.AICompletionResponse.Candidate
- (*AICompletionResponse_Candidate_Content)(nil), // 36: bytebase.v1.AICompletionResponse.Candidate.Content
- (*AICompletionResponse_Candidate_Content_Part)(nil), // 37: bytebase.v1.AICompletionResponse.Candidate.Content.Part
- (*durationpb.Duration)(nil), // 38: google.protobuf.Duration
- (structpb.NullValue)(0), // 39: google.protobuf.NullValue
- (*structpb.Value)(nil), // 40: google.protobuf.Value
- (*Position)(nil), // 41: bytebase.v1.Position
- (ExportFormat)(0), // 42: bytebase.v1.ExportFormat
- (Engine)(0), // 43: bytebase.v1.Engine
- (*DatabaseMetadata)(nil), // 44: bytebase.v1.DatabaseMetadata
- (*DatabaseCatalog)(nil), // 45: bytebase.v1.DatabaseCatalog
- (*timestamppb.Timestamp)(nil), // 46: google.protobuf.Timestamp
+ (*DiffMetadataRequest)(nil), // 21: bytebase.v1.DiffMetadataRequest
+ (*DiffMetadataResponse)(nil), // 22: bytebase.v1.DiffMetadataResponse
+ (*SearchQueryHistoriesRequest)(nil), // 23: bytebase.v1.SearchQueryHistoriesRequest
+ (*SearchQueryHistoriesResponse)(nil), // 24: bytebase.v1.SearchQueryHistoriesResponse
+ (*QueryHistory)(nil), // 25: bytebase.v1.QueryHistory
+ (*AICompletionRequest)(nil), // 26: bytebase.v1.AICompletionRequest
+ (*AICompletionResponse)(nil), // 27: bytebase.v1.AICompletionResponse
+ (*QueryResult_PostgresError)(nil), // 28: bytebase.v1.QueryResult.PostgresError
+ (*QueryResult_Message)(nil), // 29: bytebase.v1.QueryResult.Message
+ (*RowValue_Timestamp)(nil), // 30: bytebase.v1.RowValue.Timestamp
+ (*RowValue_TimestampTZ)(nil), // 31: bytebase.v1.RowValue.TimestampTZ
+ (*AICompletionRequest_Message)(nil), // 32: bytebase.v1.AICompletionRequest.Message
+ (*AICompletionResponse_Candidate)(nil), // 33: bytebase.v1.AICompletionResponse.Candidate
+ (*AICompletionResponse_Candidate_Content)(nil), // 34: bytebase.v1.AICompletionResponse.Candidate.Content
+ (*AICompletionResponse_Candidate_Content_Part)(nil), // 35: bytebase.v1.AICompletionResponse.Candidate.Content.Part
+ (*durationpb.Duration)(nil), // 36: google.protobuf.Duration
+ (structpb.NullValue)(0), // 37: google.protobuf.NullValue
+ (*structpb.Value)(nil), // 38: google.protobuf.Value
+ (*Position)(nil), // 39: bytebase.v1.Position
+ (ExportFormat)(0), // 40: bytebase.v1.ExportFormat
+ (Engine)(0), // 41: bytebase.v1.Engine
+ (*DatabaseMetadata)(nil), // 42: bytebase.v1.DatabaseMetadata
+ (*DatabaseCatalog)(nil), // 43: bytebase.v1.DatabaseCatalog
+ (*timestamppb.Timestamp)(nil), // 44: google.protobuf.Timestamp
}
var file_v1_sql_service_proto_depIdxs = []int32{
10, // 0: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult
@@ -3070,54 +2974,54 @@ var file_v1_sql_service_proto_depIdxs = []int32{
10, // 2: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult
0, // 3: bytebase.v1.QueryOption.redis_run_commands_on:type_name -> bytebase.v1.QueryOption.RedisRunCommandsOn
12, // 4: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow
- 38, // 5: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration
- 30, // 6: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError
- 31, // 7: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message
+ 36, // 5: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration
+ 28, // 6: bytebase.v1.QueryResult.postgres_error:type_name -> bytebase.v1.QueryResult.PostgresError
+ 29, // 7: bytebase.v1.QueryResult.messages:type_name -> bytebase.v1.QueryResult.Message
11, // 8: bytebase.v1.QueryResult.masked:type_name -> bytebase.v1.MaskingReason
13, // 9: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue
- 39, // 10: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue
- 40, // 11: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value
- 32, // 12: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp
- 33, // 13: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ
+ 37, // 10: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue
+ 38, // 11: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value
+ 30, // 12: bytebase.v1.RowValue.timestamp_value:type_name -> bytebase.v1.RowValue.Timestamp
+ 31, // 13: bytebase.v1.RowValue.timestamp_tz_value:type_name -> bytebase.v1.RowValue.TimestampTZ
2, // 14: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status
- 41, // 15: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position
- 41, // 16: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position
- 42, // 17: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat
- 43, // 18: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine
+ 39, // 15: bytebase.v1.Advice.start_position:type_name -> bytebase.v1.Position
+ 39, // 16: bytebase.v1.Advice.end_position:type_name -> bytebase.v1.Position
+ 40, // 17: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat
+ 41, // 18: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine
3, // 19: bytebase.v1.CheckRequest.change_type:type_name -> bytebase.v1.CheckRequest.ChangeType
14, // 20: bytebase.v1.CheckResponse.advices:type_name -> bytebase.v1.Advice
- 44, // 21: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 44, // 22: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata
- 45, // 23: bytebase.v1.DiffMetadataRequest.source_catalog:type_name -> bytebase.v1.DatabaseCatalog
- 45, // 24: bytebase.v1.DiffMetadataRequest.target_catalog:type_name -> bytebase.v1.DatabaseCatalog
- 43, // 25: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine
- 27, // 26: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory
- 46, // 27: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp
- 38, // 28: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration
+ 42, // 21: bytebase.v1.DiffMetadataRequest.source_metadata:type_name -> bytebase.v1.DatabaseMetadata
+ 42, // 22: bytebase.v1.DiffMetadataRequest.target_metadata:type_name -> bytebase.v1.DatabaseMetadata
+ 43, // 23: bytebase.v1.DiffMetadataRequest.source_catalog:type_name -> bytebase.v1.DatabaseCatalog
+ 43, // 24: bytebase.v1.DiffMetadataRequest.target_catalog:type_name -> bytebase.v1.DatabaseCatalog
+ 41, // 25: bytebase.v1.DiffMetadataRequest.engine:type_name -> bytebase.v1.Engine
+ 25, // 26: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory
+ 44, // 27: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp
+ 36, // 28: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration
4, // 29: bytebase.v1.QueryHistory.type:type_name -> bytebase.v1.QueryHistory.Type
- 34, // 30: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message
- 35, // 31: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate
+ 32, // 30: bytebase.v1.AICompletionRequest.messages:type_name -> bytebase.v1.AICompletionRequest.Message
+ 33, // 31: bytebase.v1.AICompletionResponse.candidates:type_name -> bytebase.v1.AICompletionResponse.Candidate
1, // 32: bytebase.v1.QueryResult.Message.level:type_name -> bytebase.v1.QueryResult.Message.Level
- 46, // 33: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp
- 46, // 34: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp
- 36, // 35: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content
- 37, // 36: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part
+ 44, // 33: bytebase.v1.RowValue.Timestamp.google_timestamp:type_name -> google.protobuf.Timestamp
+ 44, // 34: bytebase.v1.RowValue.TimestampTZ.google_timestamp:type_name -> google.protobuf.Timestamp
+ 34, // 35: bytebase.v1.AICompletionResponse.Candidate.content:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content
+ 35, // 36: bytebase.v1.AICompletionResponse.Candidate.Content.parts:type_name -> bytebase.v1.AICompletionResponse.Candidate.Content.Part
7, // 37: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest
5, // 38: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest
- 25, // 39: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest
+ 23, // 39: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest
15, // 40: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest
19, // 41: bytebase.v1.SQLService.Check:input_type -> bytebase.v1.CheckRequest
17, // 42: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest
- 23, // 43: bytebase.v1.SQLService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest
- 28, // 44: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest
+ 21, // 43: bytebase.v1.SQLService.DiffMetadata:input_type -> bytebase.v1.DiffMetadataRequest
+ 26, // 44: bytebase.v1.SQLService.AICompletion:input_type -> bytebase.v1.AICompletionRequest
8, // 45: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse
6, // 46: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse
- 26, // 47: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse
+ 24, // 47: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse
16, // 48: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse
20, // 49: bytebase.v1.SQLService.Check:output_type -> bytebase.v1.CheckResponse
18, // 50: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse
- 24, // 51: bytebase.v1.SQLService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse
- 29, // 52: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse
+ 22, // 51: bytebase.v1.SQLService.DiffMetadata:output_type -> bytebase.v1.DiffMetadataResponse
+ 27, // 52: bytebase.v1.SQLService.AICompletion:output_type -> bytebase.v1.AICompletionResponse
45, // [45:53] is the sub-list for method output_type
37, // [37:45] is the sub-list for method input_type
37, // [37:37] is the sub-list for extension type_name
@@ -3154,14 +3058,14 @@ func file_v1_sql_service_proto_init() {
(*RowValue_TimestampValue)(nil),
(*RowValue_TimestampTzValue)(nil),
}
- file_v1_sql_service_proto_msgTypes[22].OneofWrappers = []any{}
+ file_v1_sql_service_proto_msgTypes[20].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_sql_service_proto_rawDesc), len(file_v1_sql_service_proto_rawDesc)),
NumEnums: 5,
- NumMessages: 33,
+ NumMessages: 31,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/plugin/parser/mybatis/configuration/parser.go b/backend/plugin/parser/mybatis/configuration/parser.go
deleted file mode 100644
index f6696b3c1c..0000000000
--- a/backend/plugin/parser/mybatis/configuration/parser.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Package configuration provides the parser for mybatis configuration xml file.
-package configuration
-
-import (
- "encoding/xml"
- "io"
- "strings"
-
- "github.com/pkg/errors"
-)
-
-// Configuration is the root element of mybatis configuration xml file.
-type Configuration struct {
- Environments []Environment
-}
-
-// Environment is the element of environments in mybatis configuration xml file.
-type Environment struct {
- ID string
- JDBCConnString string
-}
-
-// ParseConfiguration parses the mybatis configuration xml file likes below:
-//
-// <configuration>
-//
-// <environments default="development">
-// <environment id="development">
-// ...
-// </environment>
-// <environment id="test">
-// ...
-// </environment>
-// </environments>
-//
-// </configuration>.
-func ParseConfiguration(configurationXML string) (*Configuration, error) {
- type Environments struct {
- Environment []struct {
- ID string `xml:"id,attr"`
- Properties []struct {
- Name string `xml:"name,attr"`
- Value string `xml:"value,attr"`
- } `xml:"dataSource>property"`
- } `xml:"environment"`
- }
-
- reader := strings.NewReader(configurationXML)
- d := xml.NewDecoder(reader)
- for {
- token, err := d.Token()
- if err != nil {
- if err == io.EOF {
- return nil, nil
- }
- return nil, errors.Wrapf(err, "failed to read token")
- }
- switch t := token.(type) {
- case xml.StartElement:
- if t.Name.Local == "environments" {
- var environments Environments
- if err := d.DecodeElement(&environments, &t); err != nil {
- return nil, errors.Wrapf(err, "failed to decode environments")
- }
- var conf Configuration
- for _, environment := range environments.Environment {
- for _, property := range environment.Properties {
- if property.Name == "url" {
- conf.Environments = append(conf.Environments, Environment{
- ID: environment.ID,
- JDBCConnString: property.Value,
- })
- }
- }
- }
- return &conf, nil
- }
- default:
- }
- }
-}
diff --git a/backend/plugin/parser/mybatis/configuration/parser_test.go b/backend/plugin/parser/mybatis/configuration/parser_test.go
deleted file mode 100644
index 77b1c6ca12..0000000000
--- a/backend/plugin/parser/mybatis/configuration/parser_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package configuration
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestExtractEnvironmentIDs(t *testing.T) {
- testCases := []struct {
- configuration string
- want *Configuration
- }{
- {
- configuration: `
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE configuration
- PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
- "https://mybatis.org/dtd/mybatis-3-config.dtd">
-<configuration>
- <environments default="prod">
- <environment id="prod">
- <transactionManager type="JDBC"/>
- <dataSource type="POOLED">
- <property name="driver" value="${driver}"/>
- <property name="url" value="jdbc:mysql://localhost:3306/test"/>
- <property name="username" value="${username}"/>
- <property name="password" value="${password}"/>
- </dataSource>
- </environment>
- <environment id="test">
- <transactionManager type="JDBC"/>
- <dataSource type="POOLED">
- <property name="driver" value="${driver}"/>
- <property name="url" value="jdbc:mysql://localhost:3306/test"/>
- <property name="username" value="${username}"/>
- <property name="password" value="${password}"/>
- </dataSource>
- </environment>
- </environments>
- <mappers>
- <mapper resource="org/mybatis/example/BlogMapper.xml"/>
- </mappers>
-</configuration>
-`,
- want: &Configuration{
- Environments: []Environment{
- {
- ID: "prod",
- JDBCConnString: "jdbc:mysql://localhost:3306/test",
- },
- {
- ID: "test",
- JDBCConnString: "jdbc:mysql://localhost:3306/test",
- },
- },
- },
- },
- }
- for _, tc := range testCases {
- got, err := ParseConfiguration(tc.configuration)
- require.NoError(t, err)
- require.Equal(t, tc.want, got)
- }
-}
diff --git a/backend/plugin/parser/mybatis/mapper/ast/data_node.go b/backend/plugin/parser/mybatis/mapper/ast/data_node.go
deleted file mode 100644
index f8cc901bba..0000000000
--- a/backend/plugin/parser/mybatis/mapper/ast/data_node.go
+++ /dev/null
@@ -1,286 +0,0 @@
-// Package ast defines the abstract syntax tree of mybatis mapper xml.
-package ast
-
-import (
- "bytes"
- "io"
-
- "github.com/pkg/errors"
-)
-
-var (
- _ Node = (*TextNode)(nil)
- _ Node = (*DataNode)(nil)
- _ Node = (*ParameterNode)(nil)
- _ Node = (*VariableNode)(nil)
-)
-
-// TextNode represents a text node which only contains plain text.
-type TextNode struct {
- Text string
-}
-
-// RestoreSQL implements Node interface.
-func (n *TextNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if len(n.Text) == 0 {
- return nil
- }
- for _, b := range []byte(n.Text) {
- if b == '\n' {
- ctx.CurrentLastLine++
- }
- if _, err := w.Write([]byte{b}); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (*TextNode) isChildAcceptable(Node) bool {
- return false
-}
-
-// AddChild implements Node interface, text node does not have child.
-func (*TextNode) AddChild(Node) {}
-
-// ParameterNode represents a parameter node in mybatis mapper xml likes #{param}.
-type ParameterNode struct {
- // Name is the name of the parameter.
- Name string
-}
-
-// RestoreSQL implements Node interface, parameter node will always be restored to ctx.RestoreDataNodePlaceholder.
-func (*ParameterNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if _, err := w.Write([]byte(ctx.RestoreDataNodePlaceholder)); err != nil {
- return err
- }
- return nil
-}
-
-// isChildAcceptable implements Node interface, parameter node does not accept child.
-func (*ParameterNode) isChildAcceptable(Node) bool {
- return false
-}
-
-// AddChild implements Node interface, parameter node does not have child.
-func (*ParameterNode) AddChild(Node) {}
-
-// VariableNode represents a variable node in mybatis mapper xml likes ${variable}.
-type VariableNode struct {
- // Name is the name of the variable.
- Name string
-}
-
-// RestoreSQL implements Node interface, variable node will always be restored to ctx.RestoreDataNodePlaceholder.
-func (v *VariableNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if value, ok := ctx.Variable[v.Name]; ok {
- if _, err := w.Write([]byte(value)); err != nil {
- return err
- }
- } else {
- if _, err := w.Write([]byte(ctx.RestoreDataNodePlaceholder)); err != nil {
- return err
- }
- }
- return nil
-}
-
-// isChildAcceptable implements Node interface, variable node does not accept child.
-func (*VariableNode) isChildAcceptable(Node) bool {
- return false
-}
-
-// AddChild implements Node interface.
-func (*VariableNode) AddChild(Node) {}
-
-// DataNode represents a data node which contains plain text, parameter or variable.
-type DataNode struct {
- r *bytes.Reader
- buf []rune
- Children []Node
-}
-
-// RestoreSQL implements Node interface.
-func (d *DataNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if len(d.Children) == 0 {
- return nil
- }
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- for _, node := range d.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return err
- }
- }
- return nil
-}
-
-// NewDataNode creates a new data node.
-func NewDataNode(data []byte) *DataNode {
- return &DataNode{
- r: bytes.NewReader(data),
- }
-}
-
-func (*DataNode) isChildAcceptable(node Node) bool {
- switch node.(type) {
- case *ParameterNode, *VariableNode, *TextNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild implements Node interface.
-func (d *DataNode) AddChild(n Node) {
- if !d.isChildAcceptable(n) {
- return
- }
- d.Children = append(d.Children, n)
-}
-
-// Scan scans the data node from the bytes given in NewDataNode.
-func (d *DataNode) Scan() error {
- if d.r == nil {
- return nil
- }
- defer d.clearBufToTextNode()
-
- for {
- r, err := d.readRune()
- if err != nil {
- if err == io.EOF {
- return nil
- }
- return errors.Wrapf(err, "failed to read rune")
- }
-
- switch r {
- case '#':
- nr, err := d.readRune()
- if err != nil {
- if err == io.EOF {
- return nil
- }
- return errors.Wrapf(err, "failed to read rune")
- }
- if nr == '{' {
- if err := d.unreadRune(2); err != nil {
- return errors.Wrapf(err, "failed to unread rune")
- }
- d.clearBufToTextNode()
- if err := d.scanParameter(); err != nil {
- return errors.Wrapf(err, "failed to scan parameter")
- }
- }
- case '$':
- nr, err := d.readRune()
- if err != nil {
- if err == io.EOF {
- return nil
- }
- return errors.Wrapf(err, "failed to read rune")
- }
- if nr == '{' {
- if err := d.unreadRune(2); err != nil {
- return errors.Wrapf(err, "failed to unread rune")
- }
- d.clearBufToTextNode()
- if err := d.scanVariable(); err != nil {
- return errors.Wrapf(err, "failed to scan variable")
- }
- }
- default:
- }
- }
-}
-
-// clearBufToTextNode builds a text node from the buf, clear the buf and append the text node to the nodes.
-func (d *DataNode) clearBufToTextNode() {
- if len(d.buf) == 0 {
- return
- }
- d.AddChild(&TextNode{
- Text: string(d.buf),
- })
- d.buf = d.buf[:0]
-}
-
-// readRune reads a rune from the reader, and append the rune to the buf.
-func (d *DataNode) readRune() (rune, error) {
- r, _, err := d.r.ReadRune()
- if err != nil {
- return 0, err
- }
- d.buf = append(d.buf, r)
- return r, nil
-}
-
-func (d *DataNode) unreadRune(size int) error {
- if _, err := d.r.Seek(int64(-size), io.SeekCurrent); err != nil {
- return errors.Wrapf(err, "failed to seek size %d", size)
- }
- d.buf = d.buf[:len(d.buf)-size]
- return nil
-}
-
-// scanParameter scans the parameter node from the reader, likes #{param}.
-func (d *DataNode) scanParameter() error {
- // skip the first "#{".
- if _, err := d.readRune(); err != nil {
- return errors.Wrapf(err, "failed to read rune")
- }
- if _, err := d.readRune(); err != nil {
- return errors.Wrapf(err, "failed to read rune")
- }
-
- for {
- r, err := d.readRune()
- if err != nil {
- if err == io.EOF {
- return errors.Wrapf(err, "expected read rune '}' to close parameter node, but meet EOF")
- }
- return errors.Wrapf(err, "failed to read rune")
- }
- if r == '}' {
- // Skip the prefix '#{' and suffix '}'.
- partBuf := string(d.buf[2 : len(d.buf)-1])
- d.AddChild(&ParameterNode{
- Name: string(partBuf),
- })
- d.buf = d.buf[:0]
- return nil
- }
- }
-}
-
-// scanVariable scans the variable node from the reader, likes ${variable}.
-func (d *DataNode) scanVariable() error {
- // skip the first "${".
- if _, err := d.readRune(); err != nil {
- return errors.Wrapf(err, "failed to read rune")
- }
- if _, err := d.readRune(); err != nil {
- return errors.Wrapf(err, "failed to read rune")
- }
-
- for {
- r, err := d.readRune()
- if err != nil {
- if err == io.EOF {
- return errors.Wrapf(err, "expected read rune '}' to close parameter node, but meet EOF")
- }
- return errors.Wrapf(err, "failed to read rune")
- }
- if r == '}' {
- // Skip the prefix '${' and suffix '}'.
- partBuf := string(d.buf[2 : len(d.buf)-1])
- d.AddChild(&VariableNode{
- Name: string(partBuf),
- })
- d.buf = d.buf[:0]
- return nil
- }
- }
-}
diff --git a/backend/plugin/parser/mybatis/mapper/ast/dymamic_node.go b/backend/plugin/parser/mybatis/mapper/ast/dymamic_node.go
deleted file mode 100644
index 75c0fa18ad..0000000000
--- a/backend/plugin/parser/mybatis/mapper/ast/dymamic_node.go
+++ /dev/null
@@ -1,656 +0,0 @@
-// Package ast defines the abstract syntax tree of mybatis mapper xml.
-package ast
-
-import (
- "encoding/xml"
- "io"
- "regexp"
- "strings"
-
- "github.com/pkg/errors"
-)
-
-var (
- _ Node = (*IfNode)(nil)
-
- _ Node = (*ChooseNode)(nil)
- _ Node = (*WhenNode)(nil)
- _ Node = (*OtherwiseNode)(nil)
-
- _ Node = (*WhereNode)(nil)
- _ Node = (*SetNode)(nil)
- _ Node = (*TrimNode)(nil)
- _ Node = (*ForEachNode)(nil)
-
- _ Node = (*SQLNode)(nil)
- _ Node = (*IncludeNode)(nil)
- _ Node = (*PropertyNode)(nil)
-)
-
-// IfNode represents a if node in mybatis mapper xml likes <if test="condition">...</if>.
-type IfNode struct {
- Test string
- Children []Node
-}
-
-// NewIfNode creates a new if node.
-func NewIfNode(startElement *xml.StartElement) *IfNode {
- node := &IfNode{}
- for _, attr := range startElement.Attr {
- if attr.Name.Local == "test" {
- node.Test = attr.Value
- }
- }
- return node
-}
-
-// RestoreSQL implements Node interface, the if condition will be ignored.
-func (n *IfNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if len(n.Children) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- }
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (*IfNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L290
- switch child.(type) {
- case *DataNode, *IncludeNode, *TrimNode, *WhereNode, *SetNode, *ForEachNode, *ChooseNode, *IfNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild adds a child to the if node.
-func (n *IfNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-// ChooseNode represents a choose node in mybatis mapper xml likes <choose>...</choose>.
-type ChooseNode struct {
- Children []Node
-}
-
-// NewChooseNode creates a new choose node.
-func NewChooseNode(_ *xml.StartElement) *ChooseNode {
- return &ChooseNode{}
-}
-
-// RestoreSQL implements Node interface.
-func (n *ChooseNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if len(n.Children) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- }
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (*ChooseNode) isChildAcceptable(child Node) bool {
- switch child.(type) {
- case *WhenNode, *OtherwiseNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild implements Node interface.
-func (n *ChooseNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-// WhenNode represents a when node in mybatis mapper xml select node likes <select><when test="condition">...</when></select>.
-type WhenNode struct {
- Test string
- Children []Node
-}
-
-// NewWhenNode creates a new when node.
-func NewWhenNode(startElement *xml.StartElement) *WhenNode {
- node := &WhenNode{}
- for _, attr := range startElement.Attr {
- if attr.Name.Local == "test" {
- node.Test = attr.Value
- }
- }
- return node
-}
-
-// RestoreSQL implements Node interface, the when condition will be ignored.
-func (n *WhenNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if len(n.Children) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- }
- if len(n.Children) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- }
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (*WhenNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#LL284C1-L284C1
- switch child.(type) {
- case *DataNode, *IncludeNode, *TrimNode, *WhereNode, *SetNode, *ForEachNode, *ChooseNode, *IfNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild adds a child to the when node.
-func (n *WhenNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-// OtherwiseNode represents a otherwise node in mybatis mapper xml select node likes <select><otherwise>...</otherwise></select>.
-type OtherwiseNode struct {
- Children []Node
-}
-
-// NewOtherwiseNode creates a new otherwise node.
-func NewOtherwiseNode(_ *xml.StartElement) *OtherwiseNode {
- return &OtherwiseNode{}
-}
-
-// RestoreSQL implements Node interface.
-func (n *OtherwiseNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- if len(n.Children) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- }
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (*OtherwiseNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L288
- switch child.(type) {
- case *DataNode, *IncludeNode, *TrimNode, *WhereNode, *SetNode, *ForEachNode, *ChooseNode, *IfNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild adds a child to the otherwise node.
-func (n *OtherwiseNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-// TrimNode represents a trim node in mybatis mapper xml likes <trim prefix="prefix" suffix="suffix" prefixOverrides="prefixOverrides" suffixOverrides="suffixOverrides">...</trim>.
-type TrimNode struct {
- Prefix string
- Suffix string
- PrefixOverridesParts []string
- SuffixOverridesParts []string
- Children []Node
-}
-
-// NewTrimNode creates a new trim node.
-func NewTrimNode(startElement *xml.StartElement) *TrimNode {
- var prefix, suffix, prefixOverrides, suffixOverrides string
- for _, attr := range startElement.Attr {
- switch attr.Name.Local {
- case "prefix":
- prefix = attr.Value
- case "suffix":
- suffix = attr.Value
- case "prefixOverrides":
- prefixOverrides = attr.Value
- case "suffixOverrides":
- suffixOverrides = attr.Value
- }
- }
- return newTrimNodeWithAttrs(prefix, suffix, prefixOverrides, suffixOverrides)
-}
-
-// newTrimNodeWithAttrs creates a new trim node with given attributes.
-func newTrimNodeWithAttrs(prefix, suffix, prefixOverrides, suffixOverrides string) *TrimNode {
- prefixOverridesParts := strings.Split(prefixOverrides, "|")
- suffixOverridesParts := strings.Split(suffixOverrides, "|")
- return &TrimNode{
- Prefix: prefix,
- Suffix: suffix,
- PrefixOverridesParts: prefixOverridesParts,
- SuffixOverridesParts: suffixOverridesParts,
- }
-}
-
-// RestoreSQL implements Node interface.
-func (n *TrimNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- var stringsBuilder strings.Builder
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, &stringsBuilder); err != nil {
- return err
- }
- }
- trimmed := strings.TrimSpace(stringsBuilder.String())
- if len(trimmed) == 0 {
- return nil
- }
- // Replace the prefix and suffix with empty string if matches the part in prefixOverridesParts and suffixOverridesParts.
- for _, part := range n.PrefixOverridesParts {
- if strings.HasPrefix(trimmed, part) {
- trimmed = strings.TrimPrefix(trimmed, part)
- break
- }
- }
- for _, part := range n.SuffixOverridesParts {
- if strings.HasSuffix(trimmed, part) {
- trimmed = strings.TrimSuffix(trimmed, part)
- break
- }
- }
- if len(n.Prefix) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- if _, err := w.Write([]byte(n.Prefix)); err != nil {
- return err
- }
- }
- if len(trimmed) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- if _, err := w.Write([]byte(trimmed)); err != nil {
- return err
- }
- }
- if len(n.Suffix) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- if _, err := w.Write([]byte(n.Suffix)); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (*TrimNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L262
- switch child.(type) {
- case *DataNode, *IncludeNode, *TrimNode, *WhereNode, *SetNode, *ForEachNode, *ChooseNode, *IfNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild adds a child to the trim node.
-func (n *TrimNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-// WhereNode represents a where node in mybatis mapper xml likes <where>...</where>.
-type WhereNode struct {
- trimNode *TrimNode
-}
-
-// NewWhereNode creates a new where node.
-func NewWhereNode(_ *xml.StartElement) *WhereNode {
- return &WhereNode{
- trimNode: newTrimNodeWithAttrs("WHERE", "", "AND |OR ", ""),
- }
-}
-
-// RestoreSQL implements Node interface.
-func (n *WhereNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- return n.trimNode.RestoreSQL(ctx, w)
-}
-
-func (n *WhereNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L269
- return n.trimNode.isChildAcceptable(child)
-}
-
-// AddChild adds a child to the where node.
-func (n *WhereNode) AddChild(child Node) {
- n.trimNode.AddChild(child)
-}
-
-// SetNode represents a set node in mybatis mapper xml likes <set>...</set>.
-type SetNode struct {
- trimNode *TrimNode
-}
-
-// NewSetNode creates a new set node.
-func NewSetNode(_ *xml.StartElement) *SetNode {
- return &SetNode{
- trimNode: newTrimNodeWithAttrs("SET", "", "", ","),
- }
-}
-
-// RestoreSQL implements Node interface.
-func (n *SetNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- return n.trimNode.RestoreSQL(ctx, w)
-}
-
-func (n *SetNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L270
- return n.trimNode.isChildAcceptable(child)
-}
-
-// AddChild adds a child to the set node.
-func (n *SetNode) AddChild(child Node) {
- n.trimNode.AddChild(child)
-}
-
-// ForEachNode represents a foreach node in mybatis mapper xml likes <foreach collection="collection" item="item" index="index" open="open" close="close" separator="separator">...</foreach>.
-type ForEachNode struct {
- Collection string
- Item string
- Separator string
- Open string
- Close string
- Index string
- Children []Node
-}
-
-// NewForeachNode creates a new foreach node.
-func NewForeachNode(startElement *xml.StartElement) *ForEachNode {
- var eachNode ForEachNode
- for _, attr := range startElement.Attr {
- switch attr.Name.Local {
- case "collection":
- eachNode.Collection = attr.Value
- case "item":
- eachNode.Item = attr.Value
- case "index":
- eachNode.Index = attr.Value
- case "open":
- eachNode.Open = attr.Value
- case "close":
- eachNode.Close = attr.Value
- case "separator":
- eachNode.Separator = attr.Value
- }
- }
- return &eachNode
-}
-
-func (*ForEachNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L272
- switch child.(type) {
- case *DataNode, *IncludeNode, *TrimNode, *WhereNode, *SetNode, *ForEachNode, *ChooseNode, *IfNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild adds a child to the foreach node.
-func (n *ForEachNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-// RestoreSQL implements Node interface.
-func (n *ForEachNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- var partBuilder strings.Builder
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, &partBuilder); err != nil {
- return err
- }
- }
- part := strings.TrimSpace(partBuilder.String())
- if len(part) == 0 {
- return nil
- }
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- if len(n.Open) > 0 {
- if _, err := w.Write([]byte(n.Open)); err != nil {
- return err
- }
- }
- // We write the part twice.
- if _, err := w.Write([]byte(part)); err != nil {
- return err
- }
- if len(n.Separator) > 0 {
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- if _, err := w.Write([]byte(n.Separator)); err != nil {
- return err
- }
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- if _, err := w.Write([]byte(part)); err != nil {
- return err
- }
- }
- if len(n.Close) > 0 {
- if _, err := w.Write([]byte(n.Close)); err != nil {
- return err
- }
- }
- return nil
-}
-
-// SQLNode represents a sql node in mybatis mapper xml likes <sql id="sqlId">...</sql>.
-type SQLNode struct {
- ID string
- Children []Node
-}
-
-// NewSQLNode creates a new sql node.
-func NewSQLNode(startElement *xml.StartElement) *SQLNode {
- var id string
- for _, attr := range startElement.Attr {
- if attr.Name.Local == "id" {
- id = attr.Value
- break
- }
- }
- return &SQLNode{
- ID: id,
- }
-}
-
-func (*SQLNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L255
- switch child.(type) {
- case *DataNode, *IncludeNode, *TrimNode, *WhereNode, *SetNode, *ForEachNode, *IfNode, *ChooseNode:
- return true
- default:
- return false
- }
-}
-
-// AddChild adds a child to the sql node.
-func (n *SQLNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-// RestoreSQL implements Node interface.
-// SQLNode is a placeholder node, it will be replaced by the sql node with the same id.
-// So we don't need to restore the sql node.
-func (*SQLNode) RestoreSQL(*RestoreContext, io.Writer) error {
- return nil
-}
-
-func (n *SQLNode) String(ctx *RestoreContext) (string, error) {
- var builder strings.Builder
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, &builder); err != nil {
- return "", err
- }
- }
- return builder.String(), nil
-}
-
-// IncludeNode represents a include node in mybatis mapper xml likes <include refid="refId">...</include>.
-type IncludeNode struct {
- RefID string
- // IncludeNode can only contains property node.
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L244
- PropertyChildren []*PropertyNode
-}
-
-// NewIncludeNode creates a new include node.
-func NewIncludeNode(startElement *xml.StartElement) *IncludeNode {
- var refID string
- for _, attr := range startElement.Attr {
- if attr.Name.Local == "refid" {
- refID = attr.Value
- break
- }
- }
- return &IncludeNode{
- RefID: refID,
- }
-}
-
-// AddChild adds a child to the include node.
-func (n *IncludeNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.PropertyChildren = append(n.PropertyChildren, child.(*PropertyNode))
-}
-
-func (*IncludeNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L244
- if _, ok := child.(*PropertyNode); ok {
- return true
- }
- return false
-}
-
-// RestoreSQL implements Node interface.
-func (n *IncludeNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- variableCatcher := regexp.MustCompile(`\${([a-zA-Z0-9_]+)}`)
- // We need to replace the variable in the refID.
- refID := variableCatcher.ReplaceAllStringFunc(n.RefID, func(s string) string {
- matches := variableCatcher.FindStringSubmatch(s)
- if len(matches) != 2 {
- return s
- }
- name := matches[1]
- return ctx.Variable[name]
- })
-
- sqlNode, ok := ctx.SQLMap[refID]
- if !ok {
- return errors.Errorf("refID %s not found", n.RefID)
- }
-
- // Set all the properties.
- // It is safe we don't check whether the variable exists, because property element can only be child of include element,
- // and include element can only refers one sql element. The property element was covered by another property element
- // is not a problem, because the outer include element will not use the outer property element any more.
- for _, propertyNode := range n.PropertyChildren {
- ctx.Variable[propertyNode.Name] = propertyNode.Value
- }
-
- sqlString, err := sqlNode.String(ctx)
- if err != nil {
- return err
- }
- trimmed := strings.TrimSpace(sqlString)
- if len(trimmed) == 0 {
- return nil
- }
- if _, err := w.Write([]byte(" ")); err != nil {
- return err
- }
- if _, err := w.Write([]byte(trimmed)); err != nil {
- return err
- }
-
- // Unset all the properties.
- for _, propertyNode := range n.PropertyChildren {
- delete(ctx.Variable, propertyNode.Name)
- }
-
- return nil
-}
-
-// PropertyNode represents a property node in mybatis mapper xml likes <property name="name" value="value" />.
-type PropertyNode struct {
- Name string
- Value string
-}
-
-// NewPropertyNode creates a new property node.
-func NewPropertyNode(startElement *xml.StartElement) *PropertyNode {
- var name, value string
- for _, attr := range startElement.Attr {
- switch attr.Name.Local {
- case "name":
- name = attr.Value
- case "value":
- value = attr.Value
- }
- }
- return &PropertyNode{
- Name: name,
- Value: value,
- }
-}
-
-func (*PropertyNode) isChildAcceptable(Node) bool {
- return false
-}
-
-// AddChild adds a child to the property node.
-func (*PropertyNode) AddChild(Node) {
-}
-
-// RestoreSQL implements Node interface.
-func (*PropertyNode) RestoreSQL(*RestoreContext, io.Writer) error {
- return nil
-}
diff --git a/backend/plugin/parser/mybatis/mapper/ast/mapper_node.go b/backend/plugin/parser/mybatis/mapper/ast/mapper_node.go
deleted file mode 100644
index 61494b2555..0000000000
--- a/backend/plugin/parser/mybatis/mapper/ast/mapper_node.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Package ast defines the abstract syntax tree of mybatis mapper xml.
-package ast
-
-import (
- "encoding/xml"
- "io"
-)
-
-var (
- _ Node = (*MapperNode)(nil)
-)
-
-// MapperNode represents a mapper node in mybatis mapper xml begin with <mapper>.
-type MapperNode struct {
- Namespace string
- Children []Node
-}
-
-// RestoreSQL implements Node interface.
-func (n *MapperNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return err
- }
- }
- return nil
-}
-
-// NewMapperNode creates a new mapper node.
-func NewMapperNode(startElement *xml.StartElement) *MapperNode {
- m := &MapperNode{}
- for _, attr := range startElement.Attr {
- if attr.Name.Local == "namespace" {
- m.Namespace = attr.Value
- }
- }
- return m
-}
-
-// AddChild adds a child to the mapper node.
-func (n *MapperNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-func (*MapperNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L19
- switch child.(type) {
- case *SQLNode, *QueryNode:
- return true
- default:
- return false
- }
-}
diff --git a/backend/plugin/parser/mybatis/mapper/ast/node.go b/backend/plugin/parser/mybatis/mapper/ast/node.go
deleted file mode 100644
index 0afc45a992..0000000000
--- a/backend/plugin/parser/mybatis/mapper/ast/node.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Package ast defines the abstract syntax tree of mybatis mapper xml.
-package ast
-
-import (
- "io"
- "slices"
-)
-
-// Node is the interface implemented by all AST node types.
-type Node interface {
- // RestoreSQL restores the node to the original SQL statement.
- RestoreSQL(ctx *RestoreContext, w io.Writer) error
- // AddChild adds a child to the node.
- AddChild(child Node)
- // isChildAcceptable checks whether the child is acceptable.
- isChildAcceptable(child Node) bool
-}
-
-// RestoreContext is the context for restoring SQL statement.
-type RestoreContext struct {
- // SQLMap is the map of SQL statement, key is the id of the sql element, value is the node of the sql element.
- // It will be used to restore the <include> element.
- SQLMap map[string]*SQLNode
- // Variable is the map of variable, key is the name of the variable, value is the value of the variable.
- // It will be used to restore the ${} element.
- Variable map[string]string
- // SQLLastLineToOriginalLineMapping is the map of the last line number from SQL statement to the line number of the original SQL statement in Mybatis mapper xml.
- SQLLastLineToOriginalLineMapping map[int]int
- // CurrentLastLine is used for internal calculation.
- CurrentLastLine int
-
- // RestoreDataNodePlaceholder is the placeholder for restoring data node, it may be different in different engine.
- // For example, in MySQL, it is "?", in PostgreSQL, it is "$1".
- RestoreDataNodePlaceholder string
-}
-
-// WithRestoreDataNodePlaceholder set the placeholder for restoring data node.
-// DataNodePlaceholder is the placeholder for restoring data node, it may be different in different engine.
-// For example:
-// MyBatis: #{param}.
-// MySQL: ?.
-// PostgreSQL: $1.
-func (r *RestoreContext) WithRestoreDataNodePlaceholder(placeholder string) *RestoreContext {
- r.RestoreDataNodePlaceholder = placeholder
- return r
-}
-
-var (
- _ Node = (*RootNode)(nil)
- _ Node = (*EmptyNode)(nil)
-)
-
-// RootNode represents the root node of the AST.
-type RootNode struct {
- Children []Node
-}
-
-// MybatisSQLLineMapping represents the line mapping of the SQL statement in Mybatis mapper xml.
-type MybatisSQLLineMapping struct {
- SQLLastLine int
- OriginalEleLine int
-}
-
-// RestoreSQL implements Node interface.
-func (n *RootNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return err
- }
- }
- return nil
-}
-
-// RestoreSQLWithLineMapping restores the SQL statement and returns the sorted(SQL last line ascending) line mapping of the SQL statement in Mybatis mapper xml.
-func (n *RootNode) RestoreSQLWithLineMapping(ctx *RestoreContext, w io.Writer) ([]*MybatisSQLLineMapping, error) {
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, w); err != nil {
- return nil, err
- }
- }
- // building line mapping
- var lineMapping []*MybatisSQLLineMapping
- for sqlLastLine, originalEleLine := range ctx.SQLLastLineToOriginalLineMapping {
- lineMapping = append(lineMapping, &MybatisSQLLineMapping{
- SQLLastLine: sqlLastLine,
- OriginalEleLine: originalEleLine,
- })
- }
- slices.SortFunc(lineMapping, func(a, b *MybatisSQLLineMapping) int {
- if a.SQLLastLine < b.SQLLastLine {
- return -1
- }
- if a.SQLLastLine > b.SQLLastLine {
- return 1
- }
- return 0
- })
- return lineMapping, nil
-}
-
-// AddChild adds a child to the root node.
-func (n *RootNode) AddChild(child Node) {
- n.Children = append(n.Children, child)
-}
-
-// isChildAcceptable implements Node interface.
-func (*RootNode) isChildAcceptable(Node) bool {
- return true
-}
-
-// EmptyNode represents an unacceptable nodes in mybatis mapper xml.
-type EmptyNode struct {
-}
-
-// NewEmptyNode returns a new empty node.
-func NewEmptyNode() *EmptyNode {
- return &EmptyNode{}
-}
-
-// RestoreSQL implements Node interface.
-func (*EmptyNode) RestoreSQL(*RestoreContext, io.Writer) error {
- return nil
-}
-
-// AddChild implements Node interface.
-func (*EmptyNode) AddChild(Node) {
-}
-
-// isChildAcceptable implements Node interface.
-func (*EmptyNode) isChildAcceptable(Node) bool {
- return false
-}
diff --git a/backend/plugin/parser/mybatis/mapper/ast/query_node.go b/backend/plugin/parser/mybatis/mapper/ast/query_node.go
deleted file mode 100644
index 3279a12453..0000000000
--- a/backend/plugin/parser/mybatis/mapper/ast/query_node.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Package ast defines the abstract syntax tree of mybatis mapper xml.
-package ast
-
-import (
- "encoding/xml"
- "io"
- "strings"
-)
-
-var (
- _ Node = (*QueryNode)(nil)
-)
-
-// QueryNodeType is the type of the query node.
-type QueryNodeType uint
-
-const (
- // QueryNodeTypeSelect represents a select query node.
- QueryNodeTypeSelect QueryNodeType = iota
- // QueryNodeTypeInsert represents a insert query node.
- QueryNodeTypeInsert
- // QueryNodeTypeUpdate represents a update query node.
- QueryNodeTypeUpdate
- // QueryNodeTypeDelete represents a delete query node.
- QueryNodeTypeDelete
-)
-
-// QueryNode represents a query node.
-type QueryNode struct {
- // ID is the id of the query node.
- ID string
- // Type is the type of the query node.
- Type QueryNodeType
- // Children is the children of the query node.
- Children []Node
- // Line is the line of the <select><update><delete><insert> tag.
- Line int
-}
-
-// RestoreSQL implements Node interface.
-func (n *QueryNode) RestoreSQL(ctx *RestoreContext, w io.Writer) error {
- var sb strings.Builder
- for _, node := range n.Children {
- if err := node.RestoreSQL(ctx, &sb); err != nil {
- return err
- }
- }
- stmt := sb.String()
- trimmed := strings.TrimSpace(stmt)
- if len(trimmed) == 0 {
- return nil
- }
- if _, err := w.Write([]byte(trimmed)); err != nil {
- return err
- }
- if !strings.HasSuffix(trimmed, ";") {
- if _, err := w.Write([]byte(";")); err != nil {
- return err
- }
- }
- if _, err := w.Write([]byte("\n")); err != nil {
- return err
- }
- ctx.SQLLastLineToOriginalLineMapping[ctx.CurrentLastLine] = n.Line
- ctx.CurrentLastLine++
- return nil
-}
-
-// AddChild adds a child to the query node.
-func (n *QueryNode) AddChild(child Node) {
- if !n.isChildAcceptable(child) {
- return
- }
- n.Children = append(n.Children, child)
-}
-
-func (*QueryNode) isChildAcceptable(child Node) bool {
- // https://github.com/mybatis/mybatis-3/blob/master/src/main/resources/org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd#L19
- switch child.(type) {
- case *DataNode, *IncludeNode, *TrimNode, *WhereNode, *SetNode, *ForEachNode, *ChooseNode, *SQLNode, *IfNode:
- default:
- return false
- }
- return true
-}
-
-// NewQueryNode creates a new query node.
-func NewQueryNode(startEle *xml.StartElement, line int) *QueryNode {
- n := &QueryNode{}
- switch startEle.Name.Local {
- case "select":
- n.Type = QueryNodeTypeSelect
- case "insert":
- n.Type = QueryNodeTypeInsert
- case "update":
- n.Type = QueryNodeTypeUpdate
- case "delete":
- n.Type = QueryNodeTypeDelete
- }
-
- for _, attr := range startEle.Attr {
- if attr.Name.Local == "id" {
- n.ID = attr.Value
- }
- }
- n.Line = line
- return n
-}
diff --git a/backend/plugin/parser/mybatis/mapper/parser.go b/backend/plugin/parser/mybatis/mapper/parser.go
deleted file mode 100644
index 157c61943f..0000000000
--- a/backend/plugin/parser/mybatis/mapper/parser.go
+++ /dev/null
@@ -1,167 +0,0 @@
-// Package mapper defines the sql extractor for mybatis mapper xml.
-package mapper
-
-import (
- "encoding/xml"
- "io"
- "strings"
-
- "github.com/pkg/errors"
-
- "github.com/bytebase/bytebase/backend/plugin/parser/mybatis/mapper/ast"
-)
-
-// Parser is the mybatis mapper xml parser.
-type Parser struct {
- d *xml.Decoder
- buf []rune
- cursor uint
- currentLine int
- sqlMap map[string]*ast.SQLNode
-}
-
-// NewParser creates a new mybatis mapper xml parser.
-func NewParser(stmt string) *Parser {
- reader := strings.NewReader(stmt)
- d := xml.NewDecoder(reader)
- return &Parser{
- d: d,
- cursor: 0,
- buf: nil,
- sqlMap: make(map[string]*ast.SQLNode),
- currentLine: 1,
- }
-}
-
-// NewRestoreContext returns the restore context.
-func (p *Parser) NewRestoreContext() *ast.RestoreContext {
- return &ast.RestoreContext{
- SQLMap: p.sqlMap,
- Variable: make(map[string]string),
- SQLLastLineToOriginalLineMapping: make(map[int]int),
- CurrentLastLine: 1,
- }
-}
-
-// Parse parses the mybatis mapper xml statements, building AST without recursion, returns the root node of the AST.
-func (p *Parser) Parse() (*ast.RootNode, error) {
- root := &ast.RootNode{}
- // To avoid recursion, we use stack to store the start element and node, and consume the token one by one.
- // The length of start element stack is always equal to the length of node stack - 1, because the root nod
- // is not in the start element stack.
- var startElementStack []*xml.StartElement
- nodeStack := []ast.Node{root}
-
- for {
- token, err := p.d.Token()
- if err != nil {
- if err == io.EOF {
- if len(startElementStack) == 0 {
- return root, nil
- }
- return nil, errors.Errorf("expected to read the end element of %q, but got EOF", startElementStack[len(startElementStack)-1].Name.Local)
- }
- return nil, errors.Wrapf(err, "failed to get token from xml decoder")
- }
- switch ele := token.(type) {
- case xml.StartElement:
- newNode := p.newNodeByStartElement(&ele)
- if ele.Name.Local == "sql" {
- node, ok := newNode.(*ast.SQLNode)
- if !ok {
- return nil, errors.Errorf("failed convert to SQL node")
- }
- p.sqlMap[newNode.(*ast.SQLNode).ID] = node
- }
- startElementStack = append(startElementStack, &ele)
- nodeStack = append(nodeStack, newNode)
-
- case xml.EndElement:
- if len(startElementStack) == 0 {
- return nil, errors.Errorf("unexpected end element %q", ele.Name.Local)
- }
- if ele.Name.Local != startElementStack[len(startElementStack)-1].Name.Local {
- return nil, errors.Errorf("expected to read the name of end element is %q, but got %q", startElementStack[len(startElementStack)-1].Name.Local, ele.Name.Local)
- }
- // We will pop the start element stack and node stack at the same time.
- startElementStack = startElementStack[:len(startElementStack)-1]
- popNode := nodeStack[len(nodeStack)-1]
- // To avoid keeping many empty node in AST, we only add the node which is not an empty node to the parent node.
- if _, ok := popNode.(*ast.EmptyNode); !ok {
- nodeStack[len(nodeStack)-2].AddChild(popNode)
- }
- nodeStack = nodeStack[:len(nodeStack)-1]
- case xml.CharData:
- for _, b := range ele {
- if b == '\n' {
- p.currentLine++
- }
- }
- trimmed := strings.TrimSpace(string(ele))
- if len(trimmed) == 0 {
- continue
- }
- dataNode := ast.NewDataNode([]byte(trimmed))
- if err := dataNode.Scan(); err != nil {
- return nil, errors.Wrapf(err, "cannot parse data node")
- }
- if len(nodeStack) == 0 {
- return nil, errors.Errorf("try to append data node to parent node, but node stack is empty")
- }
- nodeStack[len(nodeStack)-1].AddChild(dataNode)
- case xml.Comment:
- for _, b := range ele {
- if b == '\n' {
- p.currentLine++
- }
- }
- case xml.Directive:
- for _, b := range ele {
- if b == '\n' {
- p.currentLine++
- }
- }
- case xml.ProcInst:
- for _, b := range ele.Inst {
- if b == '\n' {
- p.currentLine++
- }
- }
- }
- }
-}
-
-// newNodeByStartElement returns the node related to the startElement, for example, returns QueryNode for
-// start element which name is "select", "update", "insert", "delete". If the startElement is unacceptable,
-// returns an emptyNode instead.
-func (p *Parser) newNodeByStartElement(startElement *xml.StartElement) ast.Node {
- switch startElement.Name.Local {
- case "mapper":
- return ast.NewMapperNode(startElement)
- case "select", "update", "insert", "delete":
- return ast.NewQueryNode(startElement, p.currentLine)
- case "if":
- return ast.NewIfNode(startElement)
- case "choose":
- return ast.NewChooseNode(startElement)
- case "when":
- return ast.NewWhenNode(startElement)
- case "otherwise":
- return ast.NewOtherwiseNode(startElement)
- case "where":
- return ast.NewWhereNode(startElement)
- case "set":
- return ast.NewSetNode(startElement)
- case "trim":
- return ast.NewTrimNode(startElement)
- case "foreach":
- return ast.NewForeachNode(startElement)
- case "sql":
- return ast.NewSQLNode(startElement)
- case "include":
- return ast.NewIncludeNode(startElement)
- case "property":
- return ast.NewPropertyNode(startElement)
- }
- return ast.NewEmptyNode()
-}
diff --git a/backend/plugin/parser/mybatis/mapper/parser_test.go b/backend/plugin/parser/mybatis/mapper/parser_test.go
deleted file mode 100644
index 86018529f0..0000000000
--- a/backend/plugin/parser/mybatis/mapper/parser_test.go
+++ /dev/null
@@ -1,144 +0,0 @@
-// Package mapper defines the sql extractor for mybatis mapper xml.
-package mapper
-
-import (
- "io"
- "os"
- "strings"
- "testing"
-
- pgquery "github.com/pganalyze/pg_query_go/v6"
- "github.com/stretchr/testify/require"
- "gopkg.in/yaml.v3"
-
- "github.com/bytebase/bytebase/backend/plugin/parser/mybatis/mapper/ast"
- mysqlparser "github.com/bytebase/bytebase/backend/plugin/parser/mysql"
-)
-
-// TestData is the test data for mybatis parser. It contains the xml and the expected sql.
-// And the sql is expected to be restored from the xml.
-type TestData struct {
- XML string `yaml:"xml"`
- PostgreSQL string `yaml:"postgresql"`
- MySQL string `yaml:"mysql"`
-}
-
-// runTest is a helper function to run the test.
-// It will parse the xml given by `filepath` and compare the restored sql with `sql`.
-func runTest(t *testing.T, filepath string, record bool) {
- var testCases []TestData
- yamlFile, err := os.Open(filepath)
- require.NoError(t, err)
- defer yamlFile.Close()
-
- byteValue, err := io.ReadAll(yamlFile)
- require.NoError(t, err)
- err = yaml.Unmarshal(byteValue, &testCases)
- require.NoError(t, err)
-
- for i, testCase := range testCases {
- parser := NewParser(testCase.XML)
- node, err := parser.Parse()
- require.NoError(t, err)
- require.NotNil(t, node)
-
- var stringsBuilder strings.Builder
- err = node.RestoreSQL(parser.NewRestoreContext().WithRestoreDataNodePlaceholder("$1"), &stringsBuilder)
- require.NoError(t, err)
- require.NoError(t, err)
- if record {
- testCases[i].PostgreSQL = stringsBuilder.String()
- } else {
- require.Equal(t, testCase.PostgreSQL, stringsBuilder.String())
- }
-
- // The result should be parsed correctly by PostgreSQL parser.
- _, err = pgquery.Parse(testCases[i].PostgreSQL)
- require.NoError(t, err, "failed to parse restored sql with PostgreSQL parser: %s", testCases[i].PostgreSQL)
-
- stringsBuilder.Reset()
-
- err = node.RestoreSQL(parser.NewRestoreContext().WithRestoreDataNodePlaceholder("?"), &stringsBuilder)
- require.NoError(t, err)
- require.NoError(t, err)
- if record {
- testCases[i].MySQL = stringsBuilder.String()
- } else {
- require.Equal(t, testCase.MySQL, stringsBuilder.String())
- }
-
- // The result should be parsed correctly by MySQL parser.
- _, err = mysqlparser.ParseMySQL(testCases[i].MySQL)
- require.NoError(t, err, "failed to parse restored sql with MySQL parser: %s", testCases[i].MySQL)
- }
-
- if record {
- err := yamlFile.Close()
- require.NoError(t, err)
- byteValue, err = yaml.Marshal(testCases)
- require.NoError(t, err)
- err = os.WriteFile(filepath, byteValue, 0644)
- require.NoError(t, err)
- }
-}
-
-func TestParser(t *testing.T) {
- testFileList := []string{
- "test-data/test_simple_mapper.yaml",
- "test-data/test_dynamic_sql_mapper.yaml",
- }
- for _, filepath := range testFileList {
- runTest(t, filepath, false)
- }
-}
-
-func TestRestoreWithLineMapping(t *testing.T) {
- testCases := []struct {
- xml string
- sql string
- lineMapping []*ast.MybatisSQLLineMapping
- }{
- {
- xml: `<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.bytebase.test">
- <sql id="sometable">
- ${prefix}Table
- </sql>
- <sql id="someinclude">
- from
- <include refid="${include_target}"/>
- </sql>
- <select id="select" resultType="map">
- select
- field1, field2, field3
- <include refid="someinclude">
- <property name="prefix" value="Some"/>
- <property name="include_target" value="sometable"/>
- </include>
- </select>
-</mapper>
- `,
- sql: `select
- field1, field2, field3 from SomeTable;
-`,
- lineMapping: []*ast.MybatisSQLLineMapping{
- {
- SQLLastLine: 2,
- OriginalEleLine: 11,
- },
- },
- },
- }
- for _, tc := range testCases {
- parser := NewParser(tc.xml)
- node, err := parser.Parse()
- require.NoError(t, err)
- require.NotNil(t, node)
- var sb strings.Builder
- lineMapping, err := node.RestoreSQLWithLineMapping(parser.NewRestoreContext(), &sb)
- require.NoError(t, err)
- require.Equal(t, tc.sql, sb.String())
- require.Equal(t, tc.lineMapping, lineMapping)
- }
-}
diff --git a/backend/plugin/parser/mybatis/mapper/test-data/test_dynamic_sql_mapper.yaml b/backend/plugin/parser/mybatis/mapper/test-data/test_dynamic_sql_mapper.yaml
deleted file mode 100644
index 872e2a9ccc..0000000000
--- a/backend/plugin/parser/mybatis/mapper/test-data/test_dynamic_sql_mapper.yaml
+++ /dev/null
@@ -1,357 +0,0 @@
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="testIf">
- SELECT
- name,
- category,
- price
- FROM
- fruits
- WHERE
- 1=1
- <if test="category != null and category !=''">
- AND category = #{category}
- </if>
- <if test="price != null and price !=''">
- AND price = ${price}
- <if test="price >= 00">
- AND name = 'Fuji'
- </if>
- </if>
- </select>
- </mapper>
- postgresql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits
- WHERE
- 1=1 AND category = $1 AND price = $1 AND name = 'Fuji';
- mysql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits
- WHERE
- 1=1 AND category = ? AND price = ? AND name = 'Fuji';
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="testChoose">
- SELECT
- name,
- category,
- price
- FROM
- fruits
- WHERE category = 'apple'
- <choose>
- <when test="name != null">
- AND name = #{name}
- </when>
- <when test="category == 'banana'">
- AND category = #{category}
- <if test="price != null and price !=''">
- AND price = ${price}
- </if>
- </when>
- <otherwise>
- AND category = 'apple'
- </otherwise>
- </choose>
- </select>
- </mapper>
- postgresql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits
- WHERE category = 'apple' AND name = $1 AND category = $1 AND price = $1 AND category = 'apple';
- mysql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits
- WHERE category = 'apple' AND name = ? AND category = ? AND price = ? AND category = 'apple';
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="testWhere">
- SELECT
- name,
- category,
- price
- FROM
- fruits
- <where>
- AND category = 'apple'
- OR price = 200
- </where>
- </select>
- </mapper>
- postgresql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple'
- OR price = 200;
- mysql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple'
- OR price = 200;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="testTrim">
- SELECT
- name,
- category,
- price
- FROM
- fruits
- <where>
- OR category = 'apple'
- OR price = 200
- </where>
- </select>
- </mapper>
- postgresql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple'
- OR price = 200;
- mysql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple'
- OR price = 200;
-- xml: |-
- <mapper namespace="Test">
- <select id="testWhereIf">
- SELECT
- name,
- category,
- price
- FROM
- fruits
- <where>
- AND category = 'apple'
- <if test="price != null and price !=''">
- AND price = ${price}
- </if>
- </where>
- </select>
- </mapper>
- postgresql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple' AND price = $1;
- mysql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple' AND price = ?;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <update id="testSet">
- UPDATE
- fruits
- <set>
- <if test="category != null and category !=''">
- category = #{category},
- </if>
- <if test="price != null and price !=''">
- price = ${price},
- </if>
- </set>
- WHERE
- name = #{name}
- </update>
- </mapper>
- postgresql: |
- UPDATE
- fruits SET category = $1, price = $1 WHERE
- name = $1;
- mysql: |
- UPDATE
- fruits SET category = ?, price = ? WHERE
- name = ?;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="testTrimAndChoose" resultMap="RESULT_MAP">
- select users_id, name, age, sex from users
- <trim prefix="where" suffixOverrides="and" suffix=" group by users_id">
- <choose>
- <when test="usersname != null and usersname != ''">
- name like #{usersname} and
- </when>
- <when test="age != null">
- age >= #{age} and
- </when>
- <otherwise>
- users_id is not null and
- </otherwise>
- </choose>
- </trim>
- </select>
- </mapper>
- postgresql: |
- select users_id, name, age, sex from users where name like $1 and age >= $1 and users_id is not null group by users_id;
- mysql: |
- select users_id, name, age, sex from users where name like ? and age >= ? and users_id is not null group by users_id;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="testForeach">
- SELECT
- name,
- category,
- price
- FROM
- fruits
- <where>
- category = 'apple' AND
- <foreach collection="apples" item="name" open="(" close=")" separator="OR">
- name = #{name}
- </foreach>
- </where>
- </select>
- </mapper>
- postgresql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple' AND (name = $1 OR name = $1);
- mysql: |
- SELECT
- name,
- category,
- price
- FROM
- fruits WHERE category = 'apple' AND (name = ? OR name = ?);
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <sql id="someTable">
- fruits
- <where>
- category = 'apple'
- AND price = 200
- </where>
- </sql>
- <select id="testInclude">
- SELECT
- name,
- category,
- price
- FROM
- <include refid="someTable" />
- </select>
- </mapper>
- postgresql: |
- SELECT
- name,
- category,
- price
- FROM fruits WHERE category = 'apple'
- AND price = 200;
- mysql: |
- SELECT
- name,
- category,
- price
- FROM fruits WHERE category = 'apple'
- AND price = 200;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <sql id="sometable">
- ${prefix}Table
- </sql>
- <sql id="someinclude">
- from
- <include refid="${include_target}"/>
- </sql>
- <select id="select" resultType="map">
- select
- field1, field2, field3
- <include refid="someinclude">
- <property name="prefix" value="Some"/>
- <property name="include_target" value="sometable"/>
- </include>
- </select>
- </mapper>
- postgresql: |
- select
- field1, field2, field3 from SomeTable;
- mysql: |
- select
- field1, field2, field3 from SomeTable;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <sql id="sometable">
- ${prefix}Table
- </sql>
- <sql id="someinclude">
- FROM
- <include refid="${include_target}"/>
- </sql>
- <select id="selectUsers" parameterType="int" resultType="hashmap">
- SELECT * FROM users;
- </select>
- <select id="selectSuccess" resultType="map">
- SELECT * FROM users
- <where>
- <if test="id != null">
- AND id = #{id}
- </if>
- <if test="name != null">
- AND name = #{name}
- </if>
- </where>
- </select>
- <insert id="insert">
- INSERT INTO users (id, name) VALUES (#{id}, #{name})
- </insert>
- <select id="select" resultType="map">
- SELECT
- *
- <include refid="someinclude">
- <property name="prefix" value="Some"/>
- <property name="include_target" value="sometable"/>
- </include>
- </select>
- </mapper>
- postgresql: |
- SELECT * FROM users;
- SELECT * FROM users WHERE id = $1 AND name = $1;
- INSERT INTO users (id, name) VALUES ($1, $1);
- SELECT
- * FROM SomeTable;
- mysql: |
- SELECT * FROM users;
- SELECT * FROM users WHERE id = ? AND name = ?;
- INSERT INTO users (id, name) VALUES (?, ?);
- SELECT
- * FROM SomeTable;
diff --git a/backend/plugin/parser/mybatis/mapper/test-data/test_simple_mapper.yaml b/backend/plugin/parser/mybatis/mapper/test-data/test_simple_mapper.yaml
deleted file mode 100644
index 0f150c32fa..0000000000
--- a/backend/plugin/parser/mybatis/mapper/test-data/test_simple_mapper.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="selectUsers" parameterType="int" resultType="hashmap">
- select * from users where id = #{id}
- </select>
- </mapper>
- postgresql: |
- select * from users where id = $1;
- mysql: |
- select * from users where id = ?;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="selectUsers" parameterType="int" resultType="hashmap">
- select * from users where id = ${id}
- </select>
- </mapper>
- postgresql: |
- select * from users where id = $1;
- mysql: |
- select * from users where id = ?;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <select id="selectUsers" parameterType="int" resultType="hashmap">
- select * from users where id = #{id}
- </select>
- <insert id="insertUsers" parameterType="com.bytebase.test.Users">
- insert into users (id, name) values (${id}, #{name})
- </insert>
- <update id="updateUsers" parameterType="com.bytebase.test.Users">
- update users set name = #{name} where id = ${id}
- </update>
- <delete id="deleteUsers" parameterType="int">
- delete from users where id = ${id}
- </delete>
- </mapper>
- postgresql: |
- select * from users where id = $1;
- insert into users (id, name) values ($1, $1);
- update users set name = $1 where id = $1;
- delete from users where id = $1;
- mysql: |
- select * from users where id = ?;
- insert into users (id, name) values (?, ?);
- update users set name = ? where id = ?;
- delete from users where id = ?;
-- xml: |-
- <mapper namespace="com.bytebase.test">
- <!--Query users by id-->
- <select id="selectUsers" parameterType="int" resultType="hashmap">
- select * from users where id = #{id}
- </select>
- </mapper>
- postgresql: |
- select * from users where id = $1;
- mysql: |
- select * from users where id = ?;
diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts b/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
index 6a45c7ae84..5f2433f19b 100644
--- a/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/sql_service_pb.d.ts
@@ -1030,38 +1030,6 @@ export declare type CheckResponse = Message<"bytebase.v1.CheckResponse"> & {
*/
export declare const CheckResponseSchema: GenMessage<CheckResponse>;
-/**
- * @generated from message bytebase.v1.ParseMyBatisMapperRequest
- */
-export declare type ParseMyBatisMapperRequest = Message<"bytebase.v1.ParseMyBatisMapperRequest"> & {
- /**
- * @generated from field: bytes content = 1;
- */
- content: Uint8Array;
-};
-
-/**
- * Describes the message bytebase.v1.ParseMyBatisMapperRequest.
- * Use `create(ParseMyBatisMapperRequestSchema)` to create a new message.
- */
-export declare const ParseMyBatisMapperRequestSchema: GenMessage<ParseMyBatisMapperRequest>;
-
-/**
- * @generated from message bytebase.v1.ParseMyBatisMapperResponse
- */
-export declare type ParseMyBatisMapperResponse = Message<"bytebase.v1.ParseMyBatisMapperResponse"> & {
- /**
- * @generated from field: repeated string statements = 1;
- */
- statements: string[];
-};
-
-/**
- * Describes the message bytebase.v1.ParseMyBatisMapperResponse.
- * Use `create(ParseMyBatisMapperResponseSchema)` to create a new message.
- */
-export declare const ParseMyBatisMapperResponseSchema: GenMessage<ParseMyBatisMapperResponse>;
-
/**
* @generated from message bytebase.v1.DiffMetadataRequest
*/
diff --git a/frontend/src/types/proto-es/v1/sql_service_pb.js b/frontend/src/types/proto-es/v1/sql_service_pb.js
index 4d907dadd8..0253d353fa 100644
--- a/frontend/src/types/proto-es/v1/sql_service_pb.js
+++ b/frontend/src/types/proto-es/v1/sql_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_database_service } from "./database_service_pb";
* Describes the file v1/sql_service.proto.
*/
export const file_v1_sql_service = /*@__PURE__*/
- fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEisAEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAMgASgJEg0KBWxpbWl0GAQgASgFEhMKBnNjaGVtYRgGIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgHIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lckoECAIQAyJBChRBZG1pbkV4ZWN1dGVSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQihwIKDFF1ZXJ5UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCglzdGF0ZW1lbnQYAyABKAkSDQoFbGltaXQYBCABKAUS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HJldHR5UmVzcG9uc2UiHYDqMAGC0+STAhM6ASoiDi92MS9zcWwvcHJldHR5EoEBCgxEaWZmTWV0YWRhdGESIC5ieXRlYmFzZS52MS5EaWZmTWV0YWRhdGFSZXF1ZXN0GiEuYnl0ZWJhc2UudjEuRGlmZk1ldGFkYXRhUmVzcG9uc2UiLIDqMAGC0+STAiI6ASoiHS92MS9zY2hlbWFEZXNpZ246ZGlmZk1ldGFkYXRhEngKDEFJQ29tcGxldGlvbhIgLmJ5dGViYXNlLnYxLkFJQ29tcGxldGlvblJlcXVlc3QaIS5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXNwb25zZSIjkOowAoLT5JMCGToBKiIUL3YxL3NxbC9haUNvbXBsZXRpb25CNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_catalog_service, file_v1_database_service]);
+ fileDesc("ChR2MS9zcWxfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEisAEKE0FkbWluRXhlY3V0ZVJlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVieXRlYmFzZS5jb20vRGF0YWJhc2USEQoJc3RhdGVtZW50GAMgASgJEg0KBWxpbWl0GAQgASgFEhMKBnNjaGVtYRgGIAEoCUgAiAEBEhYKCWNvbnRhaW5lchgHIAEoCUgBiAEBQgkKB19zY2hlbWFCDAoKX2NvbnRhaW5lckoECAIQAyJBChRBZG1pbkV4ZWN1dGVSZXNwb25zZRIpCgdyZXN1bHRzGAEgAygLMhguYnl0ZWJhc2UudjEuUXVlcnlSZXN1bHQihwIKDFF1ZXJ5UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFWJ5dGViYXNlLmNvbS9EYXRhYmFzZRIRCgl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5ieXRlYmFzZS52MS5EaWZmTWV0YWRhdGFSZXF1ZXN0GiEuYnl0ZWJhc2UudjEuRGlmZk1ldGFkYXRhUmVzcG9uc2UiLIDqMAGC0+STAiI6ASoiHS92MS9zY2hlbWFEZXNpZ246ZGlmZk1ldGFkYXRhEngKDEFJQ29tcGxldGlvbhIgLmJ5dGViYXNlLnYxLkFJQ29tcGxldGlvblJlcXVlc3QaIS5ieXRlYmFzZS52MS5BSUNvbXBsZXRpb25SZXNwb25zZSIjkOowAoLT5JMCGToBKiIUL3YxL3NxbC9haUNvbXBsZXRpb25CNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_struct, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_database_catalog_service, file_v1_database_service]);
/**
* Describes the message bytebase.v1.AdminExecuteRequest.
@@ -206,60 +206,46 @@ export const CheckRequest_ChangeType = /*@__PURE__*/
export const CheckResponseSchema = /*@__PURE__*/
messageDesc(file_v1_sql_service, 15);
-/**
- * Describes the message bytebase.v1.ParseMyBatisMapperRequest.
- * Use `create(ParseMyBatisMapperRequestSchema)` to create a new message.
- */
-export const ParseMyBatisMapperRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 16);
-
-/**
- * Describes the message bytebase.v1.ParseMyBatisMapperResponse.
- * Use `create(ParseMyBatisMapperResponseSchema)` to create a new message.
- */
-export const ParseMyBatisMapperResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 17);
-
/**
* Describes the message bytebase.v1.DiffMetadataRequest.
* Use `create(DiffMetadataRequestSchema)` to create a new message.
*/
export const DiffMetadataRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 18);
+ messageDesc(file_v1_sql_service, 16);
/**
* Describes the message bytebase.v1.DiffMetadataResponse.
* Use `create(DiffMetadataResponseSchema)` to create a new message.
*/
export const DiffMetadataResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 19);
+ messageDesc(file_v1_sql_service, 17);
/**
* Describes the message bytebase.v1.SearchQueryHistoriesRequest.
* Use `create(SearchQueryHistoriesRequestSchema)` to create a new message.
*/
export const SearchQueryHistoriesRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 20);
+ messageDesc(file_v1_sql_service, 18);
/**
* Describes the message bytebase.v1.SearchQueryHistoriesResponse.
* Use `create(SearchQueryHistoriesResponseSchema)` to create a new message.
*/
export const SearchQueryHistoriesResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 21);
+ messageDesc(file_v1_sql_service, 19);
/**
* Describes the message bytebase.v1.QueryHistory.
* Use `create(QueryHistorySchema)` to create a new message.
*/
export const QueryHistorySchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 22);
+ messageDesc(file_v1_sql_service, 20);
/**
* Describes the enum bytebase.v1.QueryHistory.Type.
*/
export const QueryHistory_TypeSchema = /*@__PURE__*/
- enumDesc(file_v1_sql_service, 22, 0);
+ enumDesc(file_v1_sql_service, 20, 0);
/**
* @generated from enum bytebase.v1.QueryHistory.Type
@@ -272,42 +258,42 @@ export const QueryHistory_Type = /*@__PURE__*/
* Use `create(AICompletionRequestSchema)` to create a new message.
*/
export const AICompletionRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 23);
+ messageDesc(file_v1_sql_service, 21);
/**
* Describes the message bytebase.v1.AICompletionRequest.Message.
* Use `create(AICompletionRequest_MessageSchema)` to create a new message.
*/
export const AICompletionRequest_MessageSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 23, 0);
+ messageDesc(file_v1_sql_service, 21, 0);
/**
* Describes the message bytebase.v1.AICompletionResponse.
* Use `create(AICompletionResponseSchema)` to create a new message.
*/
export const AICompletionResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 24);
+ messageDesc(file_v1_sql_service, 22);
/**
* Describes the message bytebase.v1.AICompletionResponse.Candidate.
* Use `create(AICompletionResponse_CandidateSchema)` to create a new message.
*/
export const AICompletionResponse_CandidateSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 24, 0);
+ messageDesc(file_v1_sql_service, 22, 0);
/**
* Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.
* Use `create(AICompletionResponse_Candidate_ContentSchema)` to create a new message.
*/
export const AICompletionResponse_Candidate_ContentSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 24, 0, 0);
+ messageDesc(file_v1_sql_service, 22, 0, 0);
/**
* Describes the message bytebase.v1.AICompletionResponse.Candidate.Content.Part.
* Use `create(AICompletionResponse_Candidate_Content_PartSchema)` to create a new message.
*/
export const AICompletionResponse_Candidate_Content_PartSchema = /*@__PURE__*/
- messageDesc(file_v1_sql_service, 24, 0, 0, 0);
+ messageDesc(file_v1_sql_service, 22, 0, 0, 0);
/**
* @generated from service bytebase.v1.SQLService
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index b99bc1871e..7397ca4cd9 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -507,8 +507,6 @@
- [ExportRequest](#bytebase-v1-ExportRequest)
- [ExportResponse](#bytebase-v1-ExportResponse)
- [MaskingReason](#bytebase-v1-MaskingReason)
- - [ParseMyBatisMapperRequest](#bytebase-v1-ParseMyBatisMapperRequest)
- - [ParseMyBatisMapperResponse](#bytebase-v1-ParseMyBatisMapperResponse)
- [PrettyRequest](#bytebase-v1-PrettyRequest)
- [PrettyResponse](#bytebase-v1-PrettyResponse)
- [QueryHistory](#bytebase-v1-QueryHistory)
@@ -8417,36 +8415,6 @@ ISSUE_CREATE represents creating an issue. |
-<a name="bytebase-v1-ParseMyBatisMapperRequest"></a>
-
-### ParseMyBatisMapperRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| content | [bytes](#bytes) | | |
-
-
-
-
-
-
-<a name="bytebase-v1-ParseMyBatisMapperResponse"></a>
-
-### ParseMyBatisMapperResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| statements | [string](#string) | repeated | |
-
-
-
-
-
-
<a name="bytebase-v1-PrettyRequest"></a>
### PrettyRequest
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 2d75a26bef..d987b58684 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -2117,14 +2117,6 @@
<a href="#bytebase.v1.MaskingReason"><span class="badge">M</span>MaskingReason</a>
</li>
- <li>
- <a href="#bytebase.v1.ParseMyBatisMapperRequest"><span class="badge">M</span>ParseMyBatisMapperRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.ParseMyBatisMapperResponse"><span class="badge">M</span>ParseMyBatisMapperResponse</a>
- </li>
-
<li>
<a href="#bytebase.v1.PrettyRequest"><span class="badge">M</span>PrettyRequest</a>
</li>
@@ -23426,54 +23418,6 @@ data source. </p></td>
- <h3 id="bytebase.v1.ParseMyBatisMapperRequest">ParseMyBatisMapperRequest</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>content</td>
- <td><a href="#bytes">bytes</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.ParseMyBatisMapperResponse">ParseMyBatisMapperResponse</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>statements</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
<h3 id="bytebase.v1.PrettyRequest">PrettyRequest</h3>
<p></p>
diff --git a/proto/v1/v1/sql_service.proto b/proto/v1/v1/sql_service.proto
index 9a3784f7c7..f29f7bff6b 100644
--- a/proto/v1/v1/sql_service.proto
+++ b/proto/v1/v1/sql_service.proto
@@ -462,14 +462,6 @@ message CheckResponse {
int32 affected_rows = 2;
}
-message ParseMyBatisMapperRequest {
- bytes content = 1;
-}
-
-message ParseMyBatisMapperResponse {
- repeated string statements = 1;
-}
-
message DiffMetadataRequest {
// The metadata of the source schema.
DatabaseMetadata source_metadata = 1 [(google.api.field_behavior) = REQUIRED];