-
Notifications
You must be signed in to change notification settings - Fork 0
/
number_int16.go
54 lines (50 loc) · 881 Bytes
/
number_int16.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
package pjn
func Int16(value int16) Value {
if value == 0 {
return Zero
} else {
return func(buf *Buffer) (err error) {
buf.AppendInt16(value)
return nil
}
}
}
func NullableInt16(ref *int16) Value {
if ref == nil {
return Null
} else {
return Int16(*ref)
}
}
func BindInt16(ref *int16) Value {
if ref == nil {
return produceError(ErrNilReference)
} else {
return func(buf *Buffer) error {
if *ref == 0 {
buf.AppendByte(valueNumberZero)
} else {
buf.AppendInt16(*ref)
}
return nil
}
}
}
func BindNullableInt16(ref **int16) Value {
if ref == nil {
return produceError(ErrNilReference)
} else {
return func(buf *Buffer) error {
if *ref == nil {
buf.AppendBytes(valueNull)
} else {
if **ref == 0 {
buf.AppendByte(valueNumberZero)
} else {
buf.AppendInt16(**ref)
}
}
return nil
}
}
}