-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (37 loc) · 1.13 KB
/
main.go
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
package main
import (
"app/controllers"
"bufio"
"os"
"fmt"
"strings"
"time"
)
func init() {
}
func main() {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Start of the retrieval period (DD-MM-YYYY): ")
startDateStr, _ := reader.ReadString('\n')
startDateStr = strings.TrimSuffix(startDateStr, "\n")
fmt.Print("End of the retrieval period (DD-MM-YYYY): ")
endDateStr, _ := reader.ReadString('\n')
endDateStr = strings.TrimSuffix(endDateStr, "\n")
for !(isValid(startDateStr, endDateStr)) {
fmt.Print("Start of the retrieval period (DD-MM-YYYY): ")
startDateStr, _ = reader.ReadString('\n')
startDateStr = strings.TrimSuffix(startDateStr, "\n")
fmt.Print("End of the retrieval period (DD-MM-YYYY): ")
endDateStr, _ = reader.ReadString('\n')
endDateStr = strings.TrimSuffix(endDateStr, "\n")
}
startDate, _ := time.Parse("02-01-2006", startDateStr)
endDate, _ := time.Parse("02-01-2006", endDateStr)
inbox := new(controllers.Inbox)
inbox.Create()
inbox.StoreMessages(startDate, endDate)
}
// isValid returns true. Assume that the correct start/end dates are entered
func isValid(begin, end string) bool {
return true
}