mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-08 04:39:13 +02:00
fix:#7 fixed models lint
This commit is contained in:
@@ -24,7 +24,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestEvents_Contains(t *testing.T) {
|
func TestEvents_Contains(t *testing.T) {
|
||||||
specificTime, _ := time.Parse("2020-01-01 12:00:00.000Z", "2020-01-01 12:00:00.000Z")
|
// parse time for JSONTime "2020-01-01 12:00:00.000Z"
|
||||||
|
specificTime, _ := time.Parse("2020-01-01T12:00:00.000Z", "2020-01-01 12:00:00.000Z")
|
||||||
specificJSONTime := JSONTime(specificTime)
|
specificJSONTime := JSONTime(specificTime)
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
@@ -72,7 +73,7 @@ func TestEvents_Contains(t *testing.T) {
|
|||||||
|
|
||||||
func TestEvent_Equals(t *testing.T) {
|
func TestEvent_Equals(t *testing.T) {
|
||||||
|
|
||||||
specificTime, _ := time.Parse("2020-01-01 12:00:00.000Z", "2020-01-01 12:00:00.000Z")
|
specificTime, _ := time.Parse("2020-01-01T12:00:00.000Z", "2020-01-01 12:00:00.000Z")
|
||||||
specificJSONTime := JSONTime(specificTime)
|
specificJSONTime := JSONTime(specificTime)
|
||||||
|
|
||||||
type fields struct {
|
type fields struct {
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
type BaseModel struct {
|
type BaseModel struct {
|
||||||
isNotNew bool
|
|
||||||
Id string `db:"id" json:"id"`
|
Id string `db:"id" json:"id"`
|
||||||
Created JSONTime `db:"created" json:"created"`
|
Created JSONTime `db:"created" json:"created"`
|
||||||
Updated JSONTime `db:"updated" json:"updated"`
|
Updated JSONTime `db:"updated" json:"updated"`
|
||||||
|
@@ -18,7 +18,6 @@ package model
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -79,5 +78,5 @@ func (jt *JSONTime) UnmarshalJSON(b []byte) error {
|
|||||||
*jt = JSONTime(t)
|
*jt = JSONTime(t)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return errors.New(fmt.Sprintf("Invalid date format: %s", timeString))
|
return fmt.Errorf("error parsing time string %s: %w", timeString, err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user