mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-09-30 08:35:45 +02:00
Minor adjustments, Example poc for sub commands with 'app start' and 'app stop' working concepts
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user