Skip to content

Commit d64daad

Browse files
committed
docs: Add introduction for ZeroValue and EpochValue methods
1 parent 0824576 commit d64daad

3 files changed

Lines changed: 3 additions & 18 deletions

File tree

README.cn.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,23 +1458,18 @@ person: {Date:2020-08-05 DateMilli:2020-08-05.999 DateMicro:2020-08-05.999999 Da
14581458
```
14591459

14601460
###### 自定义字段类型
1461+
> 你可以实现 `carbon.DataTyper` 接口的 `DataType` 方法来重置数据库字段类型
14611462
14621463
```go
14631464
type RFC3339Type string
14641465
func (t RFC3339Type) Layout() string {
14651466
return carbon.RFC3339Layout
14661467
}
1467-
func (t RFC3339Type) DataType() string {
1468-
return "datetime"
1469-
}
14701468

14711469
type ISO8601Type string
14721470
func (t ISO8601Type) Format() string {
14731471
return carbon.ISO8601Format
14741472
}
1475-
func (t ISO8601Type) DataType() string {
1476-
return "datetime"
1477-
}
14781473

14791474
type User struct {
14801475
Customer1 *carbon.LayoutType[RFC3339Type] `json:"customer1"`

README.jp.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,23 +1453,18 @@ person: {Date:2020-08-05 DateMilli:2020-08-05.999 DateMicro:2020-08-05.999999 Da
14531453
```
14541454

14551455
###### カスタムフィールドタイプ
1456+
> データベースフィールドタイプをリセットするには、`carbon.DataTyper` インタフェースの `DataType` メソッドを実装できます
14561457
14571458
```go
14581459
type RFC3339Type string
14591460
func (t RFC3339Type) Layout() string {
14601461
return carbon.RFC3339Layout
14611462
}
1462-
func (t RFC3339Type) DataType() string {
1463-
return "datetime"
1464-
}
14651463

14661464
type ISO8601Type string
14671465
func (t ISO8601Type) Format() string {
14681466
return carbon.ISO8601Format
14691467
}
1470-
func (t ISO8601Type) DataType() string {
1471-
return "datetime"
1472-
}
14731468

14741469
type User struct {
14751470
Customer1 *carbon.LayoutType[RFC3339Type] `json:"customer1"`

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,23 +1450,18 @@ person: {Date:2020-08-05 DateMilli:2020-08-05.999 DateMicro:2020-08-05.999999 Da
14501450
```
14511451

14521452
###### Customize type
1453+
> You can implement the `DataType` method of the `carbon.DataTyper` interface to reset database field type
14531454
14541455
```go
14551456
type RFC3339Type string
14561457
func (t RFC3339Type) Layout() string {
14571458
return carbon.RFC3339Layout
14581459
}
1459-
func (t RFC3339Type) DataType() string {
1460-
return "datetime"
1461-
}
14621460

14631461
type ISO8601Type string
14641462
func (t ISO8601Type) Format() string {
14651463
return carbon.ISO8601Format
14661464
}
1467-
func (t ISO8601Type) DataType() string {
1468-
return "datetime"
1469-
}
14701465

14711466
type User struct {
14721467
Customer1 *carbon.LayoutType[RFC3339Type] `json:"customer1"`

0 commit comments

Comments
 (0)