From 3bf1f1a83a4c090d261c75e927058c61ddbd7ee3 Mon Sep 17 00:00:00 2001 From: Peleus <245629560@qq.com> Date: Mon, 14 Oct 2024 15:58:10 +0800 Subject: [PATCH] Remove `GormDataType` from `encoding.go` to `database.go` --- database.go | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/database.go b/database.go index 05802ac8..a3c5cc9d 100644 --- a/database.go +++ b/database.go @@ -33,3 +33,99 @@ func (c Carbon) Value() (driver.Value, error) { func (c Carbon) GormDataType() string { return "time" } + +// GormDataType implements the interface GormDataTypeInterface for DateTime struct. +// 实现 GormDataTypeInterface 接口 +func (t DateTime) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for DateTimeMilli struct. +// 实现 GormDataTypeInterface 接口 +func (t DateTimeMilli) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for DateTimeMicro struct. +// 实现 GormDataTypeInterface 接口 +func (t DateTimeMicro) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for DateTimeNano struct. +// 实现 GormDataTypeInterface 接口 +func (t DateTimeNano) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for Date struct. +// 实现 GormDataTypeInterface 接口 +func (t Date) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for DateMilli struct. +// 实现 GormDataTypeInterface 接口 +func (t DateMilli) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for DateMicro struct. +// 实现 GormDataTypeInterface 接口 +func (t DateMicro) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for DateNano struct. +// 实现 GormDataTypeInterface 接口 +func (t DateNano) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for Time struct. +// 实现 GormDataTypeInterface 接口 +func (t Time) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for TimeMilli struct. +// 实现 GormDataTypeInterface 接口 +func (t TimeMilli) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for TimeMicro struct. +// 实现 GormDataTypeInterface 接口 +func (t TimeMicro) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for TimeNano struct. +// 实现 GormDataTypeInterface 接口 +func (t TimeNano) GormDataType() string { + return "time" +} + +// GormDataType implements the interface GormDataTypeInterface for Timestamp struct. +// 实现 GormDataTypeInterface 接口 +func (t Timestamp) GormDataType() string { + return "int" +} + +// GormDataType implements the interface GormDataTypeInterface for TimestampMilli struct. +// 实现 GormDataTypeInterface 接口 +func (t TimestampMilli) GormDataType() string { + return "int" +} + +// GormDataType implements the interface GormDataTypeInterface for TimestampMicro struct. +// 实现 GormDataTypeInterface 接口 +func (t TimestampMicro) GormDataType() string { + return "int" +} + +// GormDataType implements the interface GormDataTypeInterface for TimestampNano struct. +// 实现 GormDataTypeInterface 接口 +func (t TimestampNano) GormDataType() string { + return "int" +}