-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoffsetdatetime_chain.go
More file actions
144 lines (141 loc) · 6.45 KB
/
offsetdatetime_chain.go
File metadata and controls
144 lines (141 loc) · 6.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package goda
type OffsetDateTimeChain struct {
Chain[OffsetDateTime]
}
func (o OffsetDateTimeChain) WithField(field Field, value TemporalValue) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithField)
newValue := value.Int64()
field.checkSetE(newValue, &o.eError)
if !o.ok() {
return o
}
switch field {
case FieldInstantSeconds:
o.value.datetime, o.eError = LocalDateTimeOfEpochSecond(newValue+int64(o.value.offset.totalSeconds), int64(o.value.Nanosecond()), o.value.offset)
case FieldOffsetSeconds:
o.value.offset.totalSeconds = int32(newValue)
default:
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithField(field, value).mergeError(&o.eError)
}
return o
}
func (o OffsetDateTimeChain) PlusYears(years int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusYears)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusYears(years).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusYears(years int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusYears)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusYears(years).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) PlusMonths(months int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusMonths)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusMonths(months).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusMonths(months int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusMonths)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusMonths(months).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) PlusWeeks(weeks int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusWeeks)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusWeeks(weeks).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusWeeks(weeks int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusWeeks)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusWeeks(weeks).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) PlusDays(days int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusDays)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusDays(days).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusDays(days int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusDays)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusDays(days).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) PlusHours(hours int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusHours)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusHours(hours).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusHours(hours int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusHours)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusHours(hours).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) PlusMinutes(minutes int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusMinutes)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusMinutes(minutes).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusMinutes(minutes int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusMinutes)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusMinutes(minutes).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) PlusSeconds(seconds int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusSeconds)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusSeconds(seconds).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusSeconds(seconds int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusSeconds)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusSeconds(seconds).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) PlusNanos(nanos int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnPlusNanos)
o.value.datetime = o.value.datetime.chainWithError(o.eError).PlusNanos(nanos).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) MinusNanos(nanos int64) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnMinusNanos)
o.value.datetime = o.value.datetime.chainWithError(o.eError).MinusNanos(nanos).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithYear(year Year) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithYear)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithYear(year).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithMonth(month Month) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithMonth)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithMonth(month).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithDayOfMonth(dayOfMonth int) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithDayOfMonth)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithDayOfMonth(dayOfMonth).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithDayOfYear(dayOfYear int) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithDayOfYear)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithDayOfYear(dayOfYear).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithHour(hour int) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithHour)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithHour(hour).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithMinute(minute int) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithMinute)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithMinute(minute).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithSecond(second int) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithSecond)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithSecond(second).mergeError(&o.eError)
return o
}
func (o OffsetDateTimeChain) WithNano(nanoOfSecond int) OffsetDateTimeChain {
defer o.leaveFunction(tyOffsetDateTime, fnWithNano)
o.value.datetime = o.value.datetime.chainWithError(o.eError).WithNano(nanoOfSecond).mergeError(&o.eError)
return o
}