Skip to content

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

feat: introduce position for task run result (#9521)

rebelice9e536d96a1b9
diff --git a/frontend/src/types/proto/store/task_run.ts b/frontend/src/types/proto/store/task_run.ts
index 5ec53f8dd7..32b722a417 100644
--- a/frontend/src/types/proto/store/task_run.ts
+++ b/frontend/src/types/proto/store/task_run.ts
@@ -9,10 +9,18 @@ export interface TaskRunResult {
/** Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} */
changeHistory: string;
version: string;
+ startPosition: TaskRunResult_Position | undefined;
+ endPosition: TaskRunResult_Position | undefined;
+}
+
+/** The following fields are used for error reporting. */
+export interface TaskRunResult_Position {
+ line: number;
+ column: number;
}
function createBaseTaskRunResult(): TaskRunResult {
- return { detail: "", changeHistory: "", version: "" };
+ return { detail: "", changeHistory: "", version: "", startPosition: undefined, endPosition: undefined };
}
export const TaskRunResult = {
@@ -26,6 +34,12 @@ export const TaskRunResult = {
if (message.version !== "") {
writer.uint32(26).string(message.version);
}
+ if (message.startPosition !== undefined) {
+ TaskRunResult_Position.encode(message.startPosition, writer.uint32(34).fork()).ldelim();
+ }
+ if (message.endPosition !== undefined) {
+ TaskRunResult_Position.encode(message.endPosition, writer.uint32(42).fork()).ldelim();
+ }
return writer;
},
@@ -57,6 +71,20 @@ export const TaskRunResult = {
message.version = reader.string();
continue;
+ case 4:
+ if (tag !== 34) {
+ break;
+ }
+
+ message.startPosition = TaskRunResult_Position.decode(reader, reader.uint32());
+ continue;
+ case 5:
+ if (tag !== 42) {
+ break;
+ }
+
+ message.endPosition = TaskRunResult_Position.decode(reader, reader.uint32());
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -71,6 +99,8 @@ export const TaskRunResult = {
detail: isSet(object.detail) ? globalThis.String(object.detail) : "",
changeHistory: isSet(object.changeHistory) ? globalThis.String(object.changeHistory) : "",
version: isSet(object.version) ? globalThis.String(object.version) : "",
+ startPosition: isSet(object.startPosition) ? TaskRunResult_Position.fromJSON(object.startPosition) : undefined,
+ endPosition: isSet(object.endPosition) ? TaskRunResult_Position.fromJSON(object.endPosition) : undefined,
};
},
@@ -85,6 +115,12 @@ export const TaskRunResult = {
if (message.version !== "") {
obj.version = message.version;
}
+ if (message.startPosition !== undefined) {
+ obj.startPosition = TaskRunResult_Position.toJSON(message.startPosition);
+ }
+ if (message.endPosition !== undefined) {
+ obj.endPosition = TaskRunResult_Position.toJSON(message.endPosition);
+ }
return obj;
},
@@ -96,6 +132,86 @@ export const TaskRunResult = {
message.detail = object.detail ?? "";
message.changeHistory = object.changeHistory ?? "";
message.version = object.version ?? "";
+ message.startPosition = (object.startPosition !== undefined && object.startPosition !== null)
+ ? TaskRunResult_Position.fromPartial(object.startPosition)
+ : undefined;
+ message.endPosition = (object.endPosition !== undefined && object.endPosition !== null)
+ ? TaskRunResult_Position.fromPartial(object.endPosition)
+ : undefined;
+ return message;
+ },
+};
+
+function createBaseTaskRunResult_Position(): TaskRunResult_Position {
+ return { line: 0, column: 0 };
+}
+
+export const TaskRunResult_Position = {
+ encode(message: TaskRunResult_Position, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.line !== 0) {
+ writer.uint32(8).int32(message.line);
+ }
+ if (message.column !== 0) {
+ writer.uint32(16).int32(message.column);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): TaskRunResult_Position {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseTaskRunResult_Position();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 8) {
+ break;
+ }
+
+ message.line = reader.int32();
+ continue;
+ case 2:
+ if (tag !== 16) {
+ break;
+ }
+
+ message.column = reader.int32();
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): TaskRunResult_Position {
+ return {
+ line: isSet(object.line) ? globalThis.Number(object.line) : 0,
+ column: isSet(object.column) ? globalThis.Number(object.column) : 0,
+ };
+ },
+
+ toJSON(message: TaskRunResult_Position): unknown {
+ const obj: any = {};
+ if (message.line !== 0) {
+ obj.line = Math.round(message.line);
+ }
+ if (message.column !== 0) {
+ obj.column = Math.round(message.column);
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<TaskRunResult_Position>): TaskRunResult_Position {
+ return TaskRunResult_Position.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<TaskRunResult_Position>): TaskRunResult_Position {
+ const message = createBaseTaskRunResult_Position();
+ message.line = object.line ?? 0;
+ message.column = object.column ?? 0;
return message;
},
};
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 4dc3fddb45..ee4cb24a1a 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -196,6 +196,7 @@
- [store/task_run.proto](#store_task_run-proto)
- [TaskRunResult](#bytebase-store-TaskRunResult)
+ - [TaskRunResult.Position](#bytebase-store-TaskRunResult-Position)
- [store/user.proto](#store_user-proto)
- [MFAConfig](#bytebase-store-MFAConfig)
@@ -3008,6 +3009,24 @@ SlowQueryStatisticsItem is the item of slow query statistics.
| detail | [string](#string) | | |
| change_history | [string](#string) | | Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory} |
| version | [string](#string) | | |
+| start_position | [TaskRunResult.Position](#bytebase-store-TaskRunResult-Position) | | |
+| end_position | [TaskRunResult.Position](#bytebase-store-TaskRunResult-Position) | | |
+
+
+
+
+
+
+<a name="bytebase-store-TaskRunResult-Position"></a>
+
+### TaskRunResult.Position
+The following fields are used for error reporting.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| line | [int32](#int32) | | |
+| column | [int32](#int32) | | |
diff --git a/proto/generated-go/store/task_run.pb.go b/proto/generated-go/store/task_run.pb.go
index ee3d1da6a8..67470219fb 100644
--- a/proto/generated-go/store/task_run.pb.go
+++ b/proto/generated-go/store/task_run.pb.go
@@ -27,8 +27,10 @@ type TaskRunResult struct {
Detail string `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail,omitempty"`
// Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory}
- ChangeHistory string `protobuf:"bytes,2,opt,name=change_history,json=changeHistory,proto3" json:"change_history,omitempty"`
- Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
+ ChangeHistory string `protobuf:"bytes,2,opt,name=change_history,json=changeHistory,proto3" json:"change_history,omitempty"`
+ Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
+ StartPosition *TaskRunResult_Position `protobuf:"bytes,4,opt,name=start_position,json=startPosition,proto3" json:"start_position,omitempty"`
+ EndPosition *TaskRunResult_Position `protobuf:"bytes,5,opt,name=end_position,json=endPosition,proto3" json:"end_position,omitempty"`
}
func (x *TaskRunResult) Reset() {
@@ -84,20 +86,104 @@ func (x *TaskRunResult) GetVersion() string {
return ""
}
+func (x *TaskRunResult) GetStartPosition() *TaskRunResult_Position {
+ if x != nil {
+ return x.StartPosition
+ }
+ return nil
+}
+
+func (x *TaskRunResult) GetEndPosition() *TaskRunResult_Position {
+ if x != nil {
+ return x.EndPosition
+ }
+ return nil
+}
+
+// The following fields are used for error reporting.
+type TaskRunResult_Position struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Line int32 `protobuf:"varint,1,opt,name=line,proto3" json:"line,omitempty"`
+ Column int32 `protobuf:"varint,2,opt,name=column,proto3" json:"column,omitempty"`
+}
+
+func (x *TaskRunResult_Position) Reset() {
+ *x = TaskRunResult_Position{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_store_task_run_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TaskRunResult_Position) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TaskRunResult_Position) ProtoMessage() {}
+
+func (x *TaskRunResult_Position) ProtoReflect() protoreflect.Message {
+ mi := &file_store_task_run_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TaskRunResult_Position.ProtoReflect.Descriptor instead.
+func (*TaskRunResult_Position) Descriptor() ([]byte, []int) {
+ return file_store_task_run_proto_rawDescGZIP(), []int{0, 0}
+}
+
+func (x *TaskRunResult_Position) GetLine() int32 {
+ if x != nil {
+ return x.Line
+ }
+ return 0
+}
+
+func (x *TaskRunResult_Position) GetColumn() int32 {
+ if x != nil {
+ return x.Column
+ }
+ return 0
+}
+
var File_store_task_run_proto protoreflect.FileDescriptor
var file_store_task_run_proto_rawDesc = []byte{
0x0a, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x72, 0x75, 0x6e,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
- 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x68, 0x0a, 0x0d, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x75,
- 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69,
- 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12,
- 0x25, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72,
- 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x48,
- 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
- 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
- 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f,
- 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xba, 0x02, 0x0a, 0x0d, 0x54, 0x61, 0x73, 0x6b, 0x52,
+ 0x75, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61,
+ 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c,
+ 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f,
+ 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
+ 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x12, 0x4d, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52,
+ 0x75, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x12, 0x49, 0x0a, 0x0c, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x75, 0x6e, 0x52,
+ 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b,
+ 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x36, 0x0a, 0x08, 0x50,
+ 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63,
+ 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x6c,
+ 0x75, 0x6d, 0x6e, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,
+ 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x33,
}
var (
@@ -112,16 +198,19 @@ func file_store_task_run_proto_rawDescGZIP() []byte {
return file_store_task_run_proto_rawDescData
}
-var file_store_task_run_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
+var file_store_task_run_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_store_task_run_proto_goTypes = []interface{}{
- (*TaskRunResult)(nil), // 0: bytebase.store.TaskRunResult
+ (*TaskRunResult)(nil), // 0: bytebase.store.TaskRunResult
+ (*TaskRunResult_Position)(nil), // 1: bytebase.store.TaskRunResult.Position
}
var file_store_task_run_proto_depIdxs = []int32{
- 0, // [0:0] is the sub-list for method output_type
- 0, // [0:0] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
+ 1, // 0: bytebase.store.TaskRunResult.start_position:type_name -> bytebase.store.TaskRunResult.Position
+ 1, // 1: bytebase.store.TaskRunResult.end_position:type_name -> bytebase.store.TaskRunResult.Position
+ 2, // [2:2] is the sub-list for method output_type
+ 2, // [2:2] is the sub-list for method input_type
+ 2, // [2:2] is the sub-list for extension type_name
+ 2, // [2:2] is the sub-list for extension extendee
+ 0, // [0:2] is the sub-list for field type_name
}
func init() { file_store_task_run_proto_init() }
@@ -142,6 +231,18 @@ func file_store_task_run_proto_init() {
return nil
}
}
+ file_store_task_run_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TaskRunResult_Position); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -149,7 +250,7 @@ func file_store_task_run_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_store_task_run_proto_rawDesc,
NumEnums: 0,
- NumMessages: 1,
+ NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/proto/store/task_run.proto b/proto/store/task_run.proto
index 5e11cac25d..5fa3530c4d 100644
--- a/proto/store/task_run.proto
+++ b/proto/store/task_run.proto
@@ -9,4 +9,12 @@ message TaskRunResult {
// Format: instances/{instance}/databases/{database}/changeHistories/{changeHistory}
string change_history = 2;
string version = 3;
+
+ // The following fields are used for error reporting.
+ message Position {
+ int32 line = 1;
+ int32 column = 2;
+ }
+ Position start_position = 4;
+ Position end_position = 5;
}