forked from cuelang/cue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkg.go
210 lines (204 loc) · 3.69 KB
/
pkg.go
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// Code generated by go generate. DO NOT EDIT.
//go:generate rm pkg.go
//go:generate go run ../gen/gen.go
package time
import (
"github.com/solo-io/cue/internal/core/adt"
"github.com/solo-io/cue/pkg/internal"
)
func init() {
internal.Register("time", pkg)
}
var _ = adt.TopKind // in case the adt package isn't used
var pkg = &internal.Package{
Native: []*internal.Builtin{{
Name: "Nanosecond",
Const: "1",
}, {
Name: "Microsecond",
Const: "1000",
}, {
Name: "Millisecond",
Const: "1000000",
}, {
Name: "Second",
Const: "1000000000",
}, {
Name: "Minute",
Const: "60000000000",
}, {
Name: "Hour",
Const: "3600000000000",
}, {
Name: "Duration",
Params: []internal.Param{
{Kind: adt.StringKind},
},
Result: adt.BoolKind,
Func: func(c *internal.CallCtxt) {
s := c.String(0)
if c.Do() {
c.Ret, c.Err = Duration(s)
}
},
}, {
Name: "ParseDuration",
Params: []internal.Param{
{Kind: adt.StringKind},
},
Result: adt.IntKind,
Func: func(c *internal.CallCtxt) {
s := c.String(0)
if c.Do() {
c.Ret, c.Err = ParseDuration(s)
}
},
}, {
Name: "ANSIC",
Const: "\"Mon Jan _2 15:04:05 2006\"",
}, {
Name: "UnixDate",
Const: "\"Mon Jan _2 15:04:05 MST 2006\"",
}, {
Name: "RubyDate",
Const: "\"Mon Jan 02 15:04:05 -0700 2006\"",
}, {
Name: "RFC822",
Const: "\"02 Jan 06 15:04 MST\"",
}, {
Name: "RFC822Z",
Const: "\"02 Jan 06 15:04 -0700\"",
}, {
Name: "RFC850",
Const: "\"Monday, 02-Jan-06 15:04:05 MST\"",
}, {
Name: "RFC1123",
Const: "\"Mon, 02 Jan 2006 15:04:05 MST\"",
}, {
Name: "RFC1123Z",
Const: "\"Mon, 02 Jan 2006 15:04:05 -0700\"",
}, {
Name: "RFC3339",
Const: "\"2006-01-02T15:04:05Z07:00\"",
}, {
Name: "RFC3339Nano",
Const: "\"2006-01-02T15:04:05.999999999Z07:00\"",
}, {
Name: "RFC3339Date",
Const: "\"2006-01-02\"",
}, {
Name: "Kitchen",
Const: "\"3:04PM\"",
}, {
Name: "Kitchen24",
Const: "\"15:04\"",
}, {
Name: "January",
Const: "1",
}, {
Name: "February",
Const: "2",
}, {
Name: "March",
Const: "3",
}, {
Name: "April",
Const: "4",
}, {
Name: "May",
Const: "5",
}, {
Name: "June",
Const: "6",
}, {
Name: "July",
Const: "7",
}, {
Name: "August",
Const: "8",
}, {
Name: "September",
Const: "9",
}, {
Name: "October",
Const: "10",
}, {
Name: "November",
Const: "11",
}, {
Name: "December",
Const: "12",
}, {
Name: "Sunday",
Const: "0",
}, {
Name: "Monday",
Const: "1",
}, {
Name: "Tuesday",
Const: "2",
}, {
Name: "Wednesday",
Const: "3",
}, {
Name: "Thursday",
Const: "4",
}, {
Name: "Friday",
Const: "5",
}, {
Name: "Saturday",
Const: "6",
}, {
Name: "Time",
Params: []internal.Param{
{Kind: adt.StringKind},
},
Result: adt.BoolKind,
Func: func(c *internal.CallCtxt) {
s := c.String(0)
if c.Do() {
c.Ret, c.Err = Time(s)
}
},
}, {
Name: "Format",
Params: []internal.Param{
{Kind: adt.StringKind},
{Kind: adt.StringKind},
},
Result: adt.BoolKind,
Func: func(c *internal.CallCtxt) {
value, layout := c.String(0), c.String(1)
if c.Do() {
c.Ret, c.Err = Format(value, layout)
}
},
}, {
Name: "Parse",
Params: []internal.Param{
{Kind: adt.StringKind},
{Kind: adt.StringKind},
},
Result: adt.StringKind,
Func: func(c *internal.CallCtxt) {
layout, value := c.String(0), c.String(1)
if c.Do() {
c.Ret, c.Err = Parse(layout, value)
}
},
}, {
Name: "Unix",
Params: []internal.Param{
{Kind: adt.IntKind},
{Kind: adt.IntKind},
},
Result: adt.StringKind,
Func: func(c *internal.CallCtxt) {
sec, nsec := c.Int64(0), c.Int64(1)
if c.Do() {
c.Ret = Unix(sec, nsec)
}
},
}},
}