File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
14631464type RFC3339Type string
14641465func (t RFC3339Type ) Layout () string {
14651466 return carbon.RFC3339Layout
14661467}
1467- func (t RFC3339Type ) DataType () string {
1468- return " datetime"
1469- }
14701468
14711469type ISO8601Type string
14721470func (t ISO8601Type ) Format () string {
14731471 return carbon.ISO8601Format
14741472}
1475- func (t ISO8601Type ) DataType () string {
1476- return " datetime"
1477- }
14781473
14791474type User struct {
14801475 Customer1 *carbon.LayoutType [RFC3339Type] ` json:"customer1"`
Original file line number Diff line number Diff 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
14581459type RFC3339Type string
14591460func (t RFC3339Type ) Layout () string {
14601461 return carbon.RFC3339Layout
14611462}
1462- func (t RFC3339Type ) DataType () string {
1463- return " datetime"
1464- }
14651463
14661464type ISO8601Type string
14671465func (t ISO8601Type ) Format () string {
14681466 return carbon.ISO8601Format
14691467}
1470- func (t ISO8601Type ) DataType () string {
1471- return " datetime"
1472- }
14731468
14741469type User struct {
14751470 Customer1 *carbon.LayoutType [RFC3339Type] ` json:"customer1"`
Original file line number Diff line number Diff 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
14551456type RFC3339Type string
14561457func (t RFC3339Type ) Layout () string {
14571458 return carbon.RFC3339Layout
14581459}
1459- func (t RFC3339Type ) DataType () string {
1460- return " datetime"
1461- }
14621460
14631461type ISO8601Type string
14641462func (t ISO8601Type ) Format () string {
14651463 return carbon.ISO8601Format
14661464}
1467- func (t ISO8601Type ) DataType () string {
1468- return " datetime"
1469- }
14701465
14711466type User struct {
14721467 Customer1 *carbon.LayoutType [RFC3339Type] ` json:"customer1"`
You can’t perform that action at this time.
0 commit comments