and i feel it slowing down

This commit is contained in:
Mark Bates 2019-09-01 17:50:21 -04:00
parent 85055a4cb7
commit 11770e0d51
22 changed files with 42 additions and 36 deletions

View File

@ -7,24 +7,6 @@ import (
"time" "time"
) )
const timeFmt = time.RFC3339Nano
type ModTime time.Time
func (m ModTime) MarshalJSON() ([]byte, error) {
t := time.Time(m)
return json.Marshal(t.Format(timeFmt))
}
func (m *ModTime) UnmarshalJSON(b []byte) error {
t := time.Time{}
if err := json.Unmarshal(b, &t); err != nil {
return err
}
(*m) = ModTime(t)
return nil
}
type Details struct { type Details struct {
Name string `json:"name"` Name string `json:"name"`
Size int64 `json:"size"` Size int64 `json:"size"`

View File

@ -1 +0,0 @@
package memfs

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"path/filepath" "path/filepath"

View File

@ -1,4 +1,4 @@
package memfs package memwh
// func Test_Create(t *testing.T) { // func Test_Create(t *testing.T) {
// r := require.New(t) // r := require.New(t)

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package memfs package memwh
// func Test_File_Read_Memory(t *testing.T) { // func Test_File_Read_Memory(t *testing.T) {
// r := require.New(t) // r := require.New(t)

1
fs/memwh/http.go Normal file
View File

@ -0,0 +1 @@
package memwh

View File

@ -1,4 +1,4 @@
package memfs package memwh
// func Test_HTTP_Dir(t *testing.T) { // func Test_HTTP_Dir(t *testing.T) {
// r := require.New(t) // r := require.New(t)

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"encoding/json" "encoding/json"

View File

@ -1,4 +1,4 @@
package memfs package memwh
// func Test_File_JSON(t *testing.T) { // func Test_File_JSON(t *testing.T) {
// r := require.New(t) // r := require.New(t)

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"testing" "testing"

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"os" "os"

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"os" "os"

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package memfs package memwh
// func Test_Open(t *testing.T) { // func Test_Open(t *testing.T) {
// r := require.New(t) // r := require.New(t)

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package memfs package memwh
// func Test_Stat(t *testing.T) { // func Test_Stat(t *testing.T) {
// r := require.New(t) // r := require.New(t)

View File

@ -1,4 +1,4 @@
package memfs package memwh
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package memfs package memwh
// func Test_Walk(t *testing.T) { // func Test_Walk(t *testing.T) {
// r := require.New(t) // r := require.New(t)

24
fs/mod_time.go Normal file
View File

@ -0,0 +1,24 @@
package fs
import (
"encoding/json"
"time"
)
const timeFmt = time.RFC3339Nano
type ModTime time.Time
func (m ModTime) MarshalJSON() ([]byte, error) {
t := time.Time(m)
return json.Marshal(t.Format(timeFmt))
}
func (m *ModTime) UnmarshalJSON(b []byte) error {
t := time.Time{}
if err := json.Unmarshal(b, &t); err != nil {
return err
}
(*m) = ModTime(t)
return nil
}