Documentation ¶
Overview ¶
==================================
- Name:Jerry
- DateTime:2019/5/17 13:08
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:06
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:24
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:10
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:15
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:23
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:06
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:13
- Desc:
==================================
==================================
- Name:Jerry
- DateTime:2019/5/17 13:11
- Desc:
==================================
Index ¶
- Constants
- func AesCBCEncryptToBytes(jsonData []byte, secretKey string) ([]byte, error)
- func AesCBCEncryptToString(jsonData []byte, secretKey string) (string, error)
- func AesDecryptToBytes(data, secretKey string) ([]byte, error)
- func AesDecryptToMap(data, secretKey string) (mapData map[string]interface{}, err error)
- func AesDecryptToStruct(data, secretKey string, beanPtr interface{}) (err error)
- func BinaryToDecimal(bit string) (num int)
- func Float32ToString(floatNum float32, prec ...int) (floatStr string)
- func Float64ToString(floatNum float64, prec ...int) (floatStr string)
- func FormatDate(dateStr string) (formatDate string)
- func FormatDateTime(timeStr string) (formatTime string)
- func GetRandomNumber(l int) string
- func GetRandomPureString(l int) string
- func GetRandomString(l int) string
- func Int2String(intNum int) (intStr string)
- func Int642String(intNum int64) (int64Str string)
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func ParseDate(timeStr string) (date time.Time)
- func ParseDateTime(timeStr string) (datetime time.Time)
- func SaveFileToQiniuCloud(pathType, hostName string, formFile *multipart.FileHeader, limitSize int64) (urlPath string, err error)
- func String2Float32(floatStr string) (floatNum float32)
- func String2Float64(floatStr string) (floatNum float64)
- func String2Int(intStr string) (intNum int)
- func String2Int64(intStr string) (int64Num int64)
- type Connection
Constants ¶
const ( TimeLayout = "2006-01-02 15:04:05" TimeLayout_2 = "20060102150405" DateLayout = "2006-01-02" )
Variables ¶
This section is empty.
Functions ¶
func AesCBCEncryptToBytes ¶
加密后的Bytes数组
func AesCBCEncryptToString ¶
加密后转成Base64字符串
func AesDecryptToBytes ¶
解密数据的Bytes数组
func AesDecryptToMap ¶
解密数据到Map集合
func AesDecryptToStruct ¶
解密数据到结构体
func FormatDate ¶
格式化Date成字符串
格式化前输入样式:2019-01-04T15:40:00Z 或 2019-01-04T15:40:00+08:00 格式化后返回样式:2019-01-04
func FormatDateTime ¶
格式化Datetime字符串
格式化前输入样式:2019-01-04T15:40:00Z 或 2019-01-04T15:40:00+08:00 格式化后返回样式:2019-01-04 15:40:00
func PKCS5Padding ¶
加密填充模式(添加补全码) PKCS5Padding 加密时,如果加密bytes的length不是blockSize的整数倍,需要在最后面添加填充byte
func PKCS5UnPadding ¶
解密填充模式(去除补全码) PKCS5UnPadding 解密时,需要在最后面去掉加密时添加的填充byte
func SaveFileToQiniuCloud ¶
func SaveFileToQiniuCloud(pathType, hostName string, formFile *multipart.FileHeader, limitSize int64) (urlPath string, err error)
文件上传
pathType:文件存储路径的名称,例如:photo,video hostName:七牛云的自定义域名 formFile:接收到的文件 limitSize:文件大小限制(单位Byte) path:文件路径 err:error
Types ¶
type Connection ¶
type Connection struct { SocketId string // contains filtered or unexported fields }
func InitConnection ¶
func InitConnection(wsConn *websocket.Conn) (conn *Connection, err error)
func (*Connection) Close ¶
func (this *Connection) Close()
func (*Connection) ReadMessage ¶
func (this *Connection) ReadMessage() (data []byte, err error)
func (*Connection) WriteJson ¶
func (this *Connection) WriteJson(data interface{}) (err error)
func (*Connection) WriteMessage ¶
func (this *Connection) WriteMessage(data []byte) (err error)