Skip to content

Commit

Permalink
Add LongTypeInt and LongTypeUint, default is LongTypeInt
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed May 14, 2021
1 parent da2a8fa commit 1e07f3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion encoding/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ import (
type LongType int8

const (
// LongTypeInt represents the default type is int.
LongTypeInt LongType = iota
// LongTypeUint represents the default type is uint.
LongTypeUint
// LongTypeInt64 represents the default type is int64.
LongTypeInt64 LongType = iota
LongTypeInt64
// LongTypeUint64 represents the default type is uint64.
LongTypeUint64
// LongTypeBigInt represents the default type is *big.Int.
Expand Down
4 changes: 4 additions & 0 deletions encoding/interface_deocder.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import (

func (dec *Decoder) decodeLongAsInterface() interface{} {
switch dec.LongType {
case LongTypeInt:
return dec.ReadInt()
case LongTypeUint:
return dec.ReadUint()
case LongTypeInt64:
return dec.ReadInt64()
case LongTypeUint64:
Expand Down

0 comments on commit 1e07f3c

Please sign in to comment.