Skip to content

Commit

Permalink
Update content about json
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Sep 12, 2023
1 parent c3a3945 commit 64cdc9a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 67 deletions.
43 changes: 20 additions & 23 deletions README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -1287,26 +1287,6 @@ person := Person {
CreatedAt4: carbon.Now().ToTimestampNanoStruct(),
}

person.Birthday1.String() // 2002-08-05 13:14:15
person.Birthday2.String() // 2002-08-05 13:14:15.999
person.Birthday3.String() // 2002-08-05 13:14:15.999999
person.Birthday4.String() // 2002-08-05 13:14:15.999999999

person.GraduatedAt1.String() // 2020-08-05
person.GraduatedAt2.String() // 2020-08-05.999
person.GraduatedAt3.String() // 2020-08-05.999999
person.GraduatedAt4.String() // 2020-08-05.999999999

person.CreatedAt1.String() // "1691212455"
person.CreatedAt2.String() // "1722834855999"
person.CreatedAt3.String() // "1754370855999999"
person.CreatedAt4.String() // "1754370855999999999"

person.CreatedAt1.Int64() // 1691212455
person.CreatedAt2.Int64() // 1722834855999
person.CreatedAt3.Int64() // 1754370855999999
person.CreatedAt4.Int64() // 1754370855999999999

```

###### JSON 编码
Expand Down Expand Up @@ -1362,9 +1342,26 @@ if err != nil {
// 错误处理
log.Fatal(err)
}
fmt.Printf("%+v", *person)
// 输出
{Name:gouguoyin Age:18 Birthday1:2003-07-16 16:22:02 Birthday2:2003-07-16 16:22:02.999 Birthday3:2003-07-16 16:22:02.999999 Birthday4:2003-07-16 16:22:02.999999999 GraduatedAt1:2020-08-05 GraduatedAt2:2020-08-05.999 GraduatedAt3:2020-08-05.999999 GraduatedAt4:2020-08-05.999999999 CreatedAt1:2020-08-05 13:14:15 CreatedAt2:2020-08-05 13:14:15.999 CreatedAt3:2020-08-05 13:14:15.999999 CreatedAt4:2020-08-05 13:14:15.999999999}

person.Birthday1.String() // 2002-08-05 13:14:15
person.Birthday2.String() // 2002-08-05 13:14:15.999
person.Birthday3.String() // 2002-08-05 13:14:15.999999
person.Birthday4.String() // 2002-08-05 13:14:15.999999999

person.GraduatedAt1.String() // 2020-08-05
person.GraduatedAt2.String() // 2020-08-05.999
person.GraduatedAt3.String() // 2020-08-05.999999
person.GraduatedAt4.String() // 2020-08-05.999999999

person.CreatedAt1.String() // "1691212455"
person.CreatedAt2.String() // "1722834855999"
person.CreatedAt3.String() // "1754370855999999"
person.CreatedAt4.String() // "1754370855999999999"

person.CreatedAt1.Int64() // 1691212455
person.CreatedAt2.Int64() // 1722834855999
person.CreatedAt3.Int64() // 1754370855999999
person.CreatedAt4.Int64() // 1754370855999999999
```

##### 国际化支持
Expand Down
42 changes: 20 additions & 22 deletions README.jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -1286,25 +1286,6 @@ person := Person {
CreatedAt4: carbon.Now().ToTimestampNanoStruct(),
}

person.Birthday1.String() // 2002-08-05 13:14:15
person.Birthday2.String() // 2002-08-05 13:14:15.999
person.Birthday3.String() // 2002-08-05 13:14:15.999999
person.Birthday4.String() // 2002-08-05 13:14:15.999999999

person.GraduatedAt1.String() // 2020-08-05
person.GraduatedAt2.String() // 2020-08-05.999
person.GraduatedAt3.String() // 2020-08-05.999999
person.GraduatedAt4.String() // 2020-08-05.999999999

person.CreatedAt1.String() // "1691212455"
person.CreatedAt2.String() // "1722834855999"
person.CreatedAt3.String() // "1754370855999999"
person.CreatedAt4.String() // "1754370855999999999"

person.CreatedAt1.Int64() // 1691212455
person.CreatedAt2.Int64() // 1722834855999
person.CreatedAt3.Int64() // 1754370855999999
person.CreatedAt4.Int64() // 1754370855999999999
```

###### JSON コーディング
Expand Down Expand Up @@ -1360,9 +1341,26 @@ if err != nil {
// エラー処理...
log.Fatal(c.Error)
}
fmt.Printf("%+v", *person)
// 出力
{Name:gouguoyin Age:18 Birthday1:2003-07-16 16:22:02 Birthday2:2003-07-16 16:22:02.999 Birthday3:2003-07-16 16:22:02.999999 Birthday4:2003-07-16 16:22:02.999999999 GraduatedAt1:2020-08-05 GraduatedAt2:2020-08-05.999 GraduatedAt3:2020-08-05.999999 GraduatedAt4:2020-08-05.999999999 CreatedAt1:2020-08-05 13:14:15 CreatedAt2:2020-08-05 13:14:15.999 CreatedAt3:2020-08-05 13:14:15.999999 CreatedAt4:2020-08-05 13:14:15.999999999}

person.Birthday1.String() // 2002-08-05 13:14:15
person.Birthday2.String() // 2002-08-05 13:14:15.999
person.Birthday3.String() // 2002-08-05 13:14:15.999999
person.Birthday4.String() // 2002-08-05 13:14:15.999999999

person.GraduatedAt1.String() // 2020-08-05
person.GraduatedAt2.String() // 2020-08-05.999
person.GraduatedAt3.String() // 2020-08-05.999999
person.GraduatedAt4.String() // 2020-08-05.999999999

person.CreatedAt1.String() // "1691212455"
person.CreatedAt2.String() // "1722834855999"
person.CreatedAt3.String() // "1754370855999999"
person.CreatedAt4.String() // "1754370855999999999"

person.CreatedAt1.Int64() // 1691212455
person.CreatedAt2.Int64() // 1722834855999
person.CreatedAt3.Int64() // 1754370855999999
person.CreatedAt4.Int64() // 1754370855999999999
```

##### 国際化サポート
Expand Down
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1281,25 +1281,6 @@ person := Person {
CreatedAt4: carbon.Now().ToTimestampNanoStruct(),
}

person.Birthday1.String() // 2002-08-05 13:14:15
person.Birthday2.String() // 2002-08-05 13:14:15.999
person.Birthday3.String() // 2002-08-05 13:14:15.999999
person.Birthday4.String() // 2002-08-05 13:14:15.999999999

person.GraduatedAt1.String() // 2020-08-05
person.GraduatedAt2.String() // 2020-08-05.999
person.GraduatedAt3.String() // 2020-08-05.999999
person.GraduatedAt4.String() // 2020-08-05.999999999

person.CreatedAt1.String() // "1691212455"
person.CreatedAt2.String() // "1722834855999"
person.CreatedAt3.String() // "1754370855999999"
person.CreatedAt4.String() // "1754370855999999999"

person.CreatedAt1.Int64() // 1691212455
person.CreatedAt2.Int64() // 1722834855999
person.CreatedAt3.Int64() // 1754370855999999
person.CreatedAt4.Int64() // 1754370855999999999
```

###### JSON encode
Expand Down Expand Up @@ -1355,9 +1336,26 @@ if err != nil {
// Error handle...
log.Fatal(err)
}
fmt.Printf("%+v", *person)
// Output
{Name:gouguoyin Age:18 Birthday1:2003-07-16 16:22:02 Birthday2:2003-07-16 16:22:02.999 Birthday3:2003-07-16 16:22:02.999999 Birthday4:2003-07-16 16:22:02.999999999 GraduatedAt1:2020-08-05 GraduatedAt2:2020-08-05.999 GraduatedAt3:2020-08-05.999999 GraduatedAt4:2020-08-05.999999999 CreatedAt1:2020-08-05 13:14:15 CreatedAt2:2020-08-05 13:14:15.999 CreatedAt3:2020-08-05 13:14:15.999999 CreatedAt4:2020-08-05 13:14:15.999999999}

person.Birthday1.String() // 2002-08-05 13:14:15
person.Birthday2.String() // 2002-08-05 13:14:15.999
person.Birthday3.String() // 2002-08-05 13:14:15.999999
person.Birthday4.String() // 2002-08-05 13:14:15.999999999

person.GraduatedAt1.String() // 2020-08-05
person.GraduatedAt2.String() // 2020-08-05.999
person.GraduatedAt3.String() // 2020-08-05.999999
person.GraduatedAt4.String() // 2020-08-05.999999999

person.CreatedAt1.String() // "1691212455"
person.CreatedAt2.String() // "1722834855999"
person.CreatedAt3.String() // "1754370855999999"
person.CreatedAt4.String() // "1754370855999999999"

person.CreatedAt1.Int64() // 1691212455
person.CreatedAt2.Int64() // 1722834855999
person.CreatedAt3.Int64() // 1754370855999999
person.CreatedAt4.Int64() // 1754370855999999999
```

##### I18n
Expand Down

0 comments on commit 64cdc9a

Please sign in to comment.