go_utils

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Validate      *validator.Validate
	ValidateTrans ut.Translator
)

表单验证 https://github.com/go-playground/validator

View Source
var NewFile = newFile()
View Source
var SnowFlake *snowflake.Node

Functions

func EncodePassword

func EncodePassword(password string) string

func InitSnowflake

func InitSnowflake(epoch int64, i int64)

func ValidatePassword

func ValidatePassword(encodePassword, inputPassword string) bool

func ValidateStruct

func ValidateStruct(s interface{}) error

Types

type File

type File struct {
}

func (*File) AppendFile

func (f *File) AppendFile(filename string, data []byte) error

向文件追加内容

func (*File) CreateFile

func (f *File) CreateFile(filePath string) error

调用os.MkdirAll递归创建文件夹

func (*File) IsExist

func (f *File) IsExist(path string) bool

判断所给路径文件/文件夹是否存在(返回true是存在)

func (*File) WriteFile

func (f *File) WriteFile(filename string, data []byte, perm os.FileMode) error

将数据写入文件中,如果文件已存在,覆盖

type JsonData

type JsonData struct {
	Code int         `json:"code"`
	Data interface{} `json:"data"`
	Msg  string      `json:"msg"`
}

func Json

func Json(code int, data interface{}, msg string) *JsonData

func JsonErr

func JsonErr(code int, err error) *JsonData

func JsonNoData

func JsonNoData(code int, msg string) *JsonData

func Response

func Response(code int, err error, msg string, data interface{}) *JsonData

type Page

type Page struct {
	Total       int64       `json:"total"`
	CurrentPage int         `json:"current_page"`
	PerPage     int         `json:"per_page"`
	LastPage    int         `json:"last_page"`
	Data        interface{} `json:"data"`
}

func NewPage

func NewPage(total int64, currentPage, perPage int, data interface{}) *Page

Directories

Path Synopsis
* Desc: * Package: cache * File Created: Sunday, 21st March 2021 4:04:59 pm * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Sunday, 21st March 2021 4:04:59 pm * Modified By: douxuefeng (i@douxuefeng.cn>) * Desc: * Package: cache * File Created: Sunday, 21st March 2021 3:55:50 pm * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Sunday, 21st March 2021 3:55:50 pm * Modified By: douxuefeng (i@douxuefeng.cn>)
* Desc: * Package: cache * File Created: Sunday, 21st March 2021 4:04:59 pm * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Sunday, 21st March 2021 4:04:59 pm * Modified By: douxuefeng (i@douxuefeng.cn>) * Desc: * Package: cache * File Created: Sunday, 21st March 2021 3:55:50 pm * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Sunday, 21st March 2021 3:55:50 pm * Modified By: douxuefeng (i@douxuefeng.cn>)
sms
aliyun_sms
* @Author: i@douxuefeng.cn * @Date: 2021-10-13 13:38:48 * @LastEditTime: 2021-10-13 14:05:19 * @LastEditors: i@douxuefeng.cn * @Description: * @FilePath: \go-utils\sms\aliyun_sms\aliyun.go
* @Author: i@douxuefeng.cn * @Date: 2021-10-13 13:38:48 * @LastEditTime: 2021-10-13 14:05:19 * @LastEditors: i@douxuefeng.cn * @Description: * @FilePath: \go-utils\sms\aliyun_sms\aliyun.go
* @Author: i@douxuefeng.cn * @Date: 2021-10-23 13:44:03 * @LastEditTime: 2021-10-30 16:28:45 * @LastEditors: i@douxuefeng.cn * @Description: 加密算法 * @FilePath: \go-utils\strs\string_encript.go
* @Author: i@douxuefeng.cn * @Date: 2021-10-23 13:44:03 * @LastEditTime: 2021-10-30 16:28:45 * @LastEditors: i@douxuefeng.cn * @Description: 加密算法 * @FilePath: \go-utils\strs\string_encript.go
wechat
mp/params
* Desc: * Package: params * File Created: Friday, 26th March 2021 8:45:18 am * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Friday, 26th March 2021 8:45:18 am * Modified By: douxuefeng (i@douxuefeng.cn>) * Desc: * Package: params * File Created: Saturday, 27th March 2021 9:35:31 pm * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Saturday, 27th March 2021 9:35:31 pm * Modified By: douxuefeng (i@douxuefeng.cn>) * @Author: i@douxuefeng.cn * @Date: 2021-10-25 16:15:38 * @LastEditTime: 2021-10-29 10:57:32 * @LastEditors: i@douxuefeng.cn * @Description: * @FilePath: \go-utils\wechat\mp\params\sns.go
* Desc: * Package: params * File Created: Friday, 26th March 2021 8:45:18 am * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Friday, 26th March 2021 8:45:18 am * Modified By: douxuefeng (i@douxuefeng.cn>) * Desc: * Package: params * File Created: Saturday, 27th March 2021 9:35:31 pm * Author: douxuefeng (i@douxuefeng.cn) * ----- * Last Modified: Saturday, 27th March 2021 9:35:31 pm * Modified By: douxuefeng (i@douxuefeng.cn>) * @Author: i@douxuefeng.cn * @Date: 2021-10-25 16:15:38 * @LastEditTime: 2021-10-29 10:57:32 * @LastEditors: i@douxuefeng.cn * @Description: * @FilePath: \go-utils\wechat\mp\params\sns.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL