mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
adding gres package for resource feature
This commit is contained in:
26
internal/utilbytes/utilbytes.go
Normal file
26
internal/utilbytes/utilbytes.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2019 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with this file,
|
||||
// You can obtain one at https://github.com/gogf/gf.
|
||||
|
||||
// Package utibytes provides some bytes functions for internal usage.
|
||||
package utilbytes
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Export(b []byte) string {
|
||||
buffer := bytes.NewBuffer(nil)
|
||||
buffer.WriteString("[]byte{")
|
||||
for k, v := range b {
|
||||
if k > 0 {
|
||||
buffer.WriteByte(',')
|
||||
}
|
||||
buffer.WriteString(strconv.Itoa(int(v)))
|
||||
}
|
||||
buffer.WriteString("}")
|
||||
return buffer.String()
|
||||
}
|
||||
Reference in New Issue
Block a user