mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
25 lines
355 B
Go
25 lines
355 B
Go
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()
|
|
}
|