Minor adjustments, Example poc for sub commands with 'app start' and 'app stop' working concepts

This commit is contained in:
Paulo Truta
2022-02-06 17:10:02 +00:00
parent 2f36538e1e
commit c88726917f
4 changed files with 62 additions and 8 deletions
+3 -3
View File
@@ -91,8 +91,8 @@ func GetSQLiteDbConnectionDetails() string {
}
// GetSQLiteFormattedDateTime: Given a Time, Returns a string that is formatted ready to be inserted into an SQLite Datetime field using sql.Prepare.
func GetSQLiteFormattedDateTime(t time.Time) string {
// GetFormattedDateTime: Given a Time, Returns a string that is formatted ready to be inserted into an SQLite Datetime field using sql.Prepare.
func GetFormattedDateTime(t time.Time) string {
// This date is used to indicate the layout.
const datetimeLayout = "2006-01-02 15:04:05"
formatedDatetime := t.Format(datetimeLayout)
@@ -177,7 +177,7 @@ func WriteOption(optionKey string, optionValue string) {
log.Fatal(err.Error())
}
formatedDatetime := GetSQLiteFormattedDateTime(time.Now())
formatedDatetime := GetFormattedDateTime(time.Now())
_, err = statement.Exec(optionKey, optionValue, formatedDatetime, formatedDatetime) // Execute SQL Statement
if err != nil {
+2 -2
View File
@@ -97,9 +97,9 @@ func TestGetPath(t *testing.T) {
}
}
func TestGetSQLiteFormattedDateTime(t *testing.T) {
func TestGetFormattedDateTime(t *testing.T) {
datetime := time.Date(2021, time.Month(1), 01, 1, 30, 15, 0, time.UTC)
result := GetSQLiteFormattedDateTime(datetime)
result := GetFormattedDateTime(datetime)
if result != "2021-01-01 01:30:15" {
t.Log("Expected 2021-01-01 01:30:15 but got ", result)