mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
bytesconv
This commit is contained in:
24
bytesconv/byteResult.go
Normal file
24
bytesconv/byteResult.go
Normal file
@ -0,0 +1,24 @@
|
||||
package bytesconv
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
type BytesResult []byte
|
||||
|
||||
func (r BytesResult) Hex() string {
|
||||
return hex.EncodeToString(r)
|
||||
}
|
||||
|
||||
func (r BytesResult) Base64() string {
|
||||
return base64.StdEncoding.EncodeToString(r)
|
||||
}
|
||||
|
||||
func (r BytesResult) Bytes() []byte {
|
||||
return r
|
||||
}
|
||||
|
||||
func (r BytesResult) String() string {
|
||||
return r.Hex()
|
||||
}
|
Reference in New Issue
Block a user