|
@@ -3,6 +3,8 @@ package model
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "github.com/mailru/easyjson/jlexer"
|
|
|
+ "github.com/mailru/easyjson/jwriter"
|
|
|
"io"
|
|
|
"log"
|
|
|
"regexp"
|
|
@@ -91,3 +93,16 @@ func (d *DateTime) Scan(src any) error {
|
|
|
|
|
|
return fmt.Errorf("cannot scan %T into DateTime", src)
|
|
|
}
|
|
|
+
|
|
|
+func (d *DateTime) MarshalEasyJSON(w *jwriter.Writer) {
|
|
|
+ w.RawString(fmt.Sprintf("%d", d))
|
|
|
+}
|
|
|
+
|
|
|
+func (d *DateTime) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
|
+ if l.IsNull() {
|
|
|
+ l.Skip()
|
|
|
+ *d = DateTime(0)
|
|
|
+ } else {
|
|
|
+ *d = DateTime(l.Int64())
|
|
|
+ }
|
|
|
+}
|