From 48e0a20ec2a8ab72a58a4f510d61058a9985a284 Mon Sep 17 00:00:00 2001 From: coward Date: Wed, 12 Jan 2022 14:38:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- parse_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f931f16..ca1e347 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ dateparse time by struct tag WithTagName() // 自定义你想要使用的tag名称,默认为dateFormat WithDefaultTagValue() // 定义这个tag的默认值,默认为 default WithDefaultFormat() // 定义时间格式化样式,默认为 2006-01-02 15:04:05 -WithEmptyValue() // 定义一个空值返回,当指定结构体的指定字段为空值时,返回你想要的空值,默认为 `""` +WithEmptyValue() // 定义一个空值返回,当指定结构体的指定字段为空值时,返回你想要的空值,默认为 `""` +注意: 暂不支持结构体嵌套操作 ## install&安装 ```go go get github.com/cowardmrx/dateparse_tag diff --git a/parse_test.go b/parse_test.go index a253eba..dbff829 100644 --- a/parse_test.go +++ b/parse_test.go @@ -16,11 +16,11 @@ func TestNewDateParseTag(t *testing.T) { u.Name = "张三" u.BirthDay = time.Now().String() - t.Logf("old user : %v", u) + t.Logf("user : %v", u) dp := NewDateParseTag(WithTagName("format_date")) dp.Parse(u, u) - t.Logf("new user %v", u) + t.Logf("user new %v", u) }