-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathTransGlobal.cs
More file actions
89 lines (58 loc) · 2.92 KB
/
Copy pathTransGlobal.cs
File metadata and controls
89 lines (58 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Dtmcli;
/// <summary>
/// query status only
/// </summary>
internal class TransGlobalForStatus
{
[JsonPropertyName("transaction")] public DtmTransactionForStatus Transaction { get; set; }
public class DtmTransactionForStatus
{
[JsonPropertyName("status")] public string Status { get; set; }
}
}
// convert from json to c# code, json sample: saga succeed http (dtm-labs/dtm/qs/main.go)
public class TransGlobal
{
[JsonPropertyName("branches")] public List<DtmBranch> Branches { get; set; }
[JsonPropertyName("transaction")] public DtmTransaction Transaction { get; set; }
public class DtmTransaction
{
[JsonPropertyName("id")] public int Id { get; set; }
[JsonPropertyName("create_time")] public DateTimeOffset? CreateTime { get; set; }
[JsonPropertyName("update_time")] public DateTimeOffset UpdateTime { get; set; }
[JsonPropertyName("gid")] public string Gid { get; set; }
[JsonPropertyName("trans_type")] public string TransType { get; set; }
[JsonPropertyName("steps")] public List<TransactionStep> Steps { get; set; }
[JsonPropertyName("payloads")] public List<string> Payloads { get; set; }
[JsonPropertyName("status")] public string Status { get; set; }
// [JsonPropertyName("query_prepared")] public string QueryPrepared { get; set; }
[JsonPropertyName("protocol")] public string Protocol { get; set; }
[JsonPropertyName("finish_time")] public DateTimeOffset FinishTime { get; set; }
[JsonPropertyName("options")] public string Options { get; set; }
[JsonPropertyName("next_cron_interval")]
public int NextCronInterval { get; set; }
[JsonPropertyName("next_cron_time")] public DateTimeOffset NextCronTime { get; set; }
// [JsonPropertyName("wait_result")] public bool WaitResult { get; set; }
[JsonPropertyName("concurrent")] public bool Concurrent { get; set; }
}
public class DtmBranch
{
[JsonPropertyName("id")] public int Id { get; set; }
[JsonPropertyName("create_time")] public DateTimeOffset? CreateTime { get; set; }
[JsonPropertyName("update_time")] public DateTimeOffset? UpdateTime { get; set; }
[JsonPropertyName("gid")] public string Gid { get; set; }
[JsonPropertyName("url")] public string Url { get; set; }
[JsonPropertyName("bin_data")] public string BinData { get; set; }
[JsonPropertyName("branch_id")] public string BranchId { get; set; }
[JsonPropertyName("op")] public string Op { get; set; }
[JsonPropertyName("status")] public string Status { get; set; }
}
public class TransactionStep
{
[JsonPropertyName("action")] public string Action { get; set; }
[JsonPropertyName("Compensate")] public string Compensate { get; set; }
}
}