dateparse_tag/parse_test.go
coward 6a9de038b7 🎉
2022-01-12 14:11:27 +08:00

27 lines
404 B
Go

package dateparse_tag
import (
"testing"
"time"
)
type User struct {
Name string `json:"name"`
BirthDay string `json:"birth_day" format_date:"default"`
}
func TestNewDateParseTag(t *testing.T) {
u := new(User)
u.Name = "张三"
u.BirthDay = time.Now().String()
t.Logf("old user : %v", u)
dp := NewDateParseTag(WithTagName("format_date"))
dp.Parse(u, u)
t.Logf("new user %v", u)
}