-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatatypes.go
36 lines (32 loc) · 1.07 KB
/
datatypes.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
package main
import "time"
type dtArgs struct {
Int int `json:"int" from:"query"`
Int8 int8 `json:"int8" from:"query"`
Int16 int16 `json:"int16" from:"query"`
Int32 int32 `json:"int32" from:"query"`
Int46 int64 `json:"int64" from:"query"`
Text string `json:"string" from:"query"`
Float32 float32 `json:"float32" from:"query"`
Float64 float64 `json:"float64" from:"query"`
Bool bool `json:"bool" from:"query"`
Time time.Time `json:"time" from:"query"`
Dur time.Duration `json:"dur" from:"query"`
Bytes []byte `json:"bytes" from:"query"`
Body []byte `from:"body"`
}
type dtReturn struct {
*dtArgs
XMLName struct{} `json:"-" xml:"DatatypeArgs"`
BytesAsText string `json:"bytes_as_text"`
DurAsText string `json:"dur_as_text"`
BodySize int `json:"BodySize"`
}
func types(args *dtArgs) *dtReturn {
return &dtReturn{
dtArgs: args,
BytesAsText: string(args.Bytes),
DurAsText: args.Dur.String(),
BodySize: len(args.Body),
}
}