|
| 1 | +package carbon |
| 2 | + |
| 3 | +type timestampSecondType int64 |
| 4 | + |
| 5 | +func (t timestampSecondType) setPrecision() int64 { |
| 6 | + return precisionSecond |
| 7 | +} |
| 8 | + |
| 9 | +type Timestamp = timestampType[timestampSecondType] |
| 10 | + |
| 11 | +func NewTimestamp(c *Carbon) *Timestamp { |
| 12 | + return newTimestampType[timestampSecondType](c) |
| 13 | +} |
| 14 | + |
| 15 | +type timestampMilliType int64 |
| 16 | + |
| 17 | +func (t timestampMilliType) setPrecision() int64 { |
| 18 | + return precisionMillisecond |
| 19 | +} |
| 20 | + |
| 21 | +type TimestampMilli = timestampType[timestampMilliType] |
| 22 | + |
| 23 | +func NewTimestampMilli(c *Carbon) *TimestampMilli { |
| 24 | + return newTimestampType[timestampMilliType](c) |
| 25 | +} |
| 26 | + |
| 27 | +type timestampMicroType int64 |
| 28 | + |
| 29 | +func (t timestampMicroType) setPrecision() int64 { |
| 30 | + return precisionMicrosecond |
| 31 | +} |
| 32 | + |
| 33 | +type TimestampMicro = timestampType[timestampMicroType] |
| 34 | + |
| 35 | +func NewTimestampMicro(c *Carbon) *TimestampMicro { |
| 36 | + return newTimestampType[timestampMicroType](c) |
| 37 | +} |
| 38 | + |
| 39 | +type timestampNanoType int64 |
| 40 | + |
| 41 | +func (t timestampNanoType) setPrecision() int64 { |
| 42 | + return precisionNanosecond |
| 43 | +} |
| 44 | + |
| 45 | +type TimestampNano = timestampType[timestampNanoType] |
| 46 | + |
| 47 | +func NewTimestampNano(c *Carbon) *TimestampNano { |
| 48 | + return newTimestampType[timestampNanoType](c) |
| 49 | +} |
| 50 | + |
| 51 | +type DateTimeType string |
| 52 | + |
| 53 | +func (t DateTimeType) SetLayout() string { |
| 54 | + return DateTimeLayout |
| 55 | +} |
| 56 | + |
| 57 | +type DateTime = LayoutType[DateTimeType] |
| 58 | + |
| 59 | +func NewDateTime(c *Carbon) *DateTime { |
| 60 | + return NewLayoutType[DateTimeType](c) |
| 61 | +} |
| 62 | + |
| 63 | +type DateTimeMilliType string |
| 64 | + |
| 65 | +func (t DateTimeMilliType) SetLayout() string { |
| 66 | + return DateTimeMilliLayout |
| 67 | +} |
| 68 | + |
| 69 | +type DateTimeMilli = LayoutType[DateTimeMilliType] |
| 70 | + |
| 71 | +func NewDateTimeMilli(c *Carbon) *DateTimeMilli { |
| 72 | + return NewLayoutType[DateTimeMilliType](c) |
| 73 | +} |
| 74 | + |
| 75 | +type DateTimeMicroType string |
| 76 | + |
| 77 | +func (t DateTimeMicroType) SetLayout() string { |
| 78 | + return DateTimeMicroLayout |
| 79 | +} |
| 80 | + |
| 81 | +type DateTimeMicro = LayoutType[DateTimeMicroType] |
| 82 | + |
| 83 | +func NewDateTimeMicro(c *Carbon) *DateTimeMicro { |
| 84 | + return NewLayoutType[DateTimeMicroType](c) |
| 85 | +} |
| 86 | + |
| 87 | +type DateTimeNanoType string |
| 88 | + |
| 89 | +func (t DateTimeNanoType) SetLayout() string { |
| 90 | + return DateTimeNanoLayout |
| 91 | +} |
| 92 | + |
| 93 | +type DateTimeNano = LayoutType[DateTimeNanoType] |
| 94 | + |
| 95 | +func NewDateTimeNano(c *Carbon) *DateTimeNano { |
| 96 | + return NewLayoutType[DateTimeNanoType](c) |
| 97 | +} |
| 98 | + |
| 99 | +type DateType string |
| 100 | + |
| 101 | +func (t DateType) SetLayout() string { |
| 102 | + return DateLayout |
| 103 | +} |
| 104 | + |
| 105 | +type Date = LayoutType[DateType] |
| 106 | + |
| 107 | +func NewDate(c *Carbon) *Date { |
| 108 | + return NewLayoutType[DateType](c) |
| 109 | +} |
| 110 | + |
| 111 | +type DateMilliType string |
| 112 | + |
| 113 | +func (t DateMilliType) SetLayout() string { |
| 114 | + return DateMilliLayout |
| 115 | +} |
| 116 | + |
| 117 | +type DateMilli = LayoutType[DateMilliType] |
| 118 | + |
| 119 | +func NewDateMilli(c *Carbon) *DateMilli { |
| 120 | + return NewLayoutType[DateMilliType](c) |
| 121 | +} |
| 122 | + |
| 123 | +type DateMicroType string |
| 124 | + |
| 125 | +func (t DateMicroType) SetLayout() string { |
| 126 | + return DateMicroLayout |
| 127 | +} |
| 128 | + |
| 129 | +type DateMicro = LayoutType[DateMicroType] |
| 130 | + |
| 131 | +func NewDateMicro(c *Carbon) *DateMicro { |
| 132 | + return NewLayoutType[DateMicroType](c) |
| 133 | +} |
| 134 | + |
| 135 | +type DateNanoType string |
| 136 | + |
| 137 | +func (t DateNanoType) SetLayout() string { |
| 138 | + return DateNanoLayout |
| 139 | +} |
| 140 | + |
| 141 | +type DateNano = LayoutType[DateNanoType] |
| 142 | + |
| 143 | +func NewDateNano(c *Carbon) *DateNano { |
| 144 | + return NewLayoutType[DateNanoType](c) |
| 145 | +} |
| 146 | + |
| 147 | +type TimeType string |
| 148 | + |
| 149 | +func (t TimeType) SetLayout() string { |
| 150 | + return TimeLayout |
| 151 | +} |
| 152 | + |
| 153 | +type Time = LayoutType[TimeType] |
| 154 | + |
| 155 | +func NewTime(c *Carbon) *Time { |
| 156 | + return NewLayoutType[TimeType](c) |
| 157 | +} |
| 158 | + |
| 159 | +type TimeMilliType string |
| 160 | + |
| 161 | +func (t TimeMilliType) SetLayout() string { |
| 162 | + return TimeMilliLayout |
| 163 | +} |
| 164 | + |
| 165 | +type TimeMilli = LayoutType[TimeMilliType] |
| 166 | + |
| 167 | +func NewTimeMilli(c *Carbon) *TimeMilli { |
| 168 | + return NewLayoutType[TimeMilliType](c) |
| 169 | +} |
| 170 | + |
| 171 | +type TimeMicroType string |
| 172 | + |
| 173 | +func (t TimeMicroType) SetLayout() string { |
| 174 | + return TimeMicroLayout |
| 175 | +} |
| 176 | + |
| 177 | +type TimeMicro = LayoutType[TimeMicroType] |
| 178 | + |
| 179 | +func NewTimeMicro(c *Carbon) *TimeMicro { |
| 180 | + return NewLayoutType[TimeMicroType](c) |
| 181 | +} |
| 182 | + |
| 183 | +type TimeNanoType string |
| 184 | + |
| 185 | +func (t TimeNanoType) SetLayout() string { |
| 186 | + return TimeNanoLayout |
| 187 | +} |
| 188 | + |
| 189 | +type TimeNano = LayoutType[TimeNanoType] |
| 190 | + |
| 191 | +func NewTimeNano(c *Carbon) *TimeNano { |
| 192 | + return NewLayoutType[TimeNanoType](c) |
| 193 | +} |
0 commit comments