UR now web scale

This commit is contained in:
Audrius Butkevicius
2020-06-20 21:29:39 +01:00
parent 65d0cc6423
commit c5a3ae314c
3 changed files with 108 additions and 201 deletions
+16 -3
View File
@@ -42,9 +42,9 @@ func (p *IntMap) Scan(src interface{}) error {
type Report struct {
// Generated
Received *time.Time `json:"received,omitempty"` // Only from DB
Date string `json:"date,omitempty"`
Address string `json:"address,omitempty"`
Received time.Time // Only from DB
Date string `json:"date,omitempty"`
Address string `json:"address,omitempty"`
// v1 fields
@@ -409,6 +409,19 @@ func (r *Report) FieldNames() []string {
}
}
func (r Report) Value() (driver.Value, error) {
return json.Marshal(r)
}
func (r *Report) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &r)
}
func clear(v interface{}, since int) error {
s := reflect.ValueOf(v).Elem()
t := s.Type()