1 /**
2 Copyright: Copyright (c) 2018, Joakim Brännström. All rights reserved.
3 License: MPL-2
4 Author: Joakim Brännström (joakim.brannstrom@gmx.com)
5 
6 This Source Code Form is subject to the terms of the Mozilla Public License,
7 v.2.0. If a copy of the MPL was not distributed with this file, You can obtain
8 one at http://mozilla.org/MPL/2.0/.
9 */
10 module dextool.plugin.mutate.backend.database.type;
11 
12 import core.time : Duration;
13 
14 import dextool.type : AbsolutePath, Path;
15 
16 /// Primary key in the database
17 struct Pkey(Pkeys T) {
18     long payload;
19     alias payload this;
20 }
21 
22 enum Pkeys {
23     mutationId,
24     fileId,
25     testCaseId,
26 }
27 
28 /// Primary key in the mutation table
29 alias MutationId = Pkey!(Pkeys.mutationId);
30 
31 /// Primary key in the files table
32 alias FileId = Pkey!(Pkeys.fileId);
33 
34 /// Primary key in the test_case table
35 alias TestCaseId = Pkey!(Pkeys.testCaseId);
36 
37 struct MutationEntry {
38     import dextool.plugin.mutate.backend.type;
39 
40     MutationId id;
41     Path file;
42     SourceLoc sloc;
43     MutationPoint mp;
44     Duration timeSpentMutating;
45 }
46 
47 struct NextMutationEntry {
48     import std.typecons : Nullable;
49     import dextool.plugin.mutate.backend.type;
50 
51     enum Status {
52         ok,
53         queryError,
54         done,
55     }
56 
57     Status st;
58     Nullable!MutationEntry entry;
59 }
60 
61 struct MutationPointEntry {
62     import dextool.plugin.mutate.backend.type;
63 
64     MutationPoint mp;
65     Path file;
66     SourceLoc sloc;
67 }
68 
69 struct MutationReportEntry {
70     import core.time : Duration;
71 
72     long count;
73     Duration time;
74 }