You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
378 B
27 lines
378 B
package formatime
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"testing"
|
|
)
|
|
|
|
type boo struct {
|
|
Name string `json:"name"`
|
|
CreatedAt Timestamp `json:"created_at"`
|
|
}
|
|
|
|
func Test_timestamp(t *testing.T) {
|
|
b := boo{
|
|
Name: "Boo",
|
|
CreatedAt: NewTimestampNow(),
|
|
}
|
|
|
|
jsonText, err := json.Marshal(&b)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
} else {
|
|
log.Print(string(jsonText))
|
|
}
|
|
}
|