123456789101112131415161718192021222324252627282930313233343536 |
- package optional
- type Byte struct {
- isSet bool
- value byte
- }
- func NewByte(value byte) Byte {
- return Byte{
- true,
- value,
- }
- }
- func EmptyByte() Byte {
- return Byte{
- false,
- 0,
- }
- }
- func (b Byte) IsSet() bool {
- return b.isSet
- }
- func (b Byte) Value() byte {
- return b.value
- }
- func (b Byte) Default(defaultValue byte) byte {
- if b.isSet {
- return b.value
- }
- return defaultValue
- }
|