Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

Β 

History

History
History
82 lines (73 loc) Β· 1.9 KB

File metadata and controls

82 lines (73 loc) Β· 1.9 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package main
import (
"fmt"
"time"
)
// newApp provides a new application instance.
func newApp(config *Config, inputs *Inputs, filtered *Filtered, outputs *Outputs) *App {
return &App{
Config: config,
Inputs: inputs,
Filtered: filtered,
Outputs: outputs,
}
}
// start starts an application with a beauty output to console.
func (app *App) start() error {
// Start timer.
start := time.Now()
// Check, if input data is not empty.
if app.Inputs.Data != nil {
if len(app.Inputs.Data) > 0 {
printStyled(
"Hello and welcome to csv2api! πŸ‘‹",
"margin-top-bottom",
)
printStyled(
fmt.Sprintf(
"– According to the settings in '%s', %d transactions were filtered out of %d to start the process.",
configFilePath, len(app.Filtered.Data), len(app.Inputs.Data),
),
"",
)
// Check, if output data is not empty.
if len(app.Outputs.Data) > 0 {
printStyled(
fmt.Sprintf(
"– Only %d transactions got into the final set of actions to be taken... Please wait!",
len(app.Outputs.Data),
),
"margin-bottom",
)
// Loop for all output data.
for _, data := range app.Outputs.Data {
// Start updating fields.
if err := app.updateField(data.ID, data.FieldName, data.Values); err != nil {
printStyled(
fmt.Sprintf("βœ• There was an error with collect output data: %v", err),
"margin-left",
)
}
}
// Check, if you need to save CSV file with filtered PK.
if app.Config.SaveFilteredPKToCSV {
// Save filtered PK to CSV.
if err := app.saveFilteredPKToCSV(); err != nil {
printStyled(
fmt.Sprintf("βœ• There was an error with save filtered PK to CSV: %v", err),
"margin-top",
)
}
}
}
}
printStyled(
fmt.Sprintf(
"All done! πŸŽ‰ Time elapsed: %.2fs",
time.Since(start).Seconds(),
),
"margin-top-bottom",
)
}
return nil
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.