go_utils

package module
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 12 Imported by: 0

README

go 1.18

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
* @Author: i@rysa.cn * @Date: 2022-05-14 15:59:22 * @LastEditTime: 2022-05-14 15:59:26 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\cache\cache.go
* @Author: i@rysa.cn * @Date: 2022-05-14 15:59:22 * @LastEditTime: 2022-05-14 15:59:26 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\cache\cache.go
* @Author: i@rysa.cn * @Date: 2022-06-10 17:21:12 * @LastEditTime: 2022-06-12 11:43:46 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\logger\zap.go
* @Author: i@rysa.cn * @Date: 2022-06-10 17:21:12 * @LastEditTime: 2022-06-12 11:43:46 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\logger\zap.go
sms
aliyun_sms
* @Author: i@rysa.cn * @Date: 2021-10-13 13:38:48 * @LastEditTime: 2022-05-20 10:46:41 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\sms\aliyun_sms\aliyun.go
* @Author: i@rysa.cn * @Date: 2021-10-13 13:38:48 * @LastEditTime: 2022-05-20 10:46:41 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\sms\aliyun_sms\aliyun.go
tencent_sms
* @Author: i@rysa.cn * @Date: 2022-04-09 21:31:04 * @LastEditTime: 2022-04-11 11:09:49 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\sms\tencent_sms\params.go
* @Author: i@rysa.cn * @Date: 2022-04-09 21:31:04 * @LastEditTime: 2022-04-11 11:09:49 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\sms\tencent_sms\params.go
wechat
mini/access_token
* @Author: i@rysa.cn * @Date: 2022-05-14 15:57:53 * @LastEditTime: 2022-05-14 16:01:55 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\access_token\access_token.go
* @Author: i@rysa.cn * @Date: 2022-05-14 15:57:53 * @LastEditTime: 2022-05-14 16:01:55 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\access_token\access_token.go
mini/code
* @Author: i@rysa.cn * @Date: 2022-05-14 16:04:47 * @LastEditTime: 2022-05-14 16:04:50 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\code\code.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:04:47 * @LastEditTime: 2022-05-14 16:04:50 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\code\code.go
mini/config
* @Author: i@rysa.cn * @Date: 2022-05-14 15:58:31 * @LastEditTime: 2022-05-14 15:58:37 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\config\config.go
* @Author: i@rysa.cn * @Date: 2022-05-14 15:58:31 * @LastEditTime: 2022-05-14 15:58:37 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\config\config.go
mini/params
* @Author: i@rysa.cn * @Date: 2022-05-14 16:01:48 * @LastEditTime: 2022-05-14 16:04:11 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\params\access_token.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:01:48 * @LastEditTime: 2022-05-14 16:04:11 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\params\access_token.go
mini/qrcode
* @Author: i@rysa.cn * @Date: 2022-08-01 17:18:01 * @LastEditTime: 2022-09-20 11:10:48 * @LastEditors: i@rysa.cn * @Description: * @FilePath: /go-utils/wechat/mini/qrcode/qrcode.go
* @Author: i@rysa.cn * @Date: 2022-08-01 17:18:01 * @LastEditTime: 2022-09-20 11:10:48 * @LastEditors: i@rysa.cn * @Description: * @FilePath: /go-utils/wechat/mini/qrcode/qrcode.go
mini/sns
* @Author: i@rysa.cn * @Date: 2022-05-14 16:05:33 * @LastEditTime: 2022-05-14 16:06:45 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\sns\login.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:05:33 * @LastEditTime: 2022-05-14 16:06:45 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mini\sns\login.go
mp/jssdk
* @Author: i@rysa.cn * @Date: 2022-05-14 16:42:23 * @LastEditTime: 2022-05-14 16:55:47 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\jssdk\jssdk.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:42:23 * @LastEditTime: 2022-05-14 16:55:47 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\jssdk\jssdk.go
mp/mpconfig
* @Author: i@rysa.cn * @Date: 2022-05-14 16:39:15 * @LastEditTime: 2022-05-14 16:41:27 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\mpconfig\config.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:39:15 * @LastEditTime: 2022-05-14 16:41:27 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\mpconfig\config.go
mp/openapi
* @Author: i@rysa.cn * @Date: 2022-05-14 16:54:10 * @LastEditTime: 2022-05-14 16:55:52 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\openapi\openapi.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:54:10 * @LastEditTime: 2022-05-14 16:55:52 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\openapi\openapi.go
mp/params
* @Author: i@rysa.cn * @Date: 2022-05-14 16:37:00 * @LastEditTime: 2022-05-14 16:37:03 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\params\access_token.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:37:00 * @LastEditTime: 2022-05-14 16:37:03 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\params\access_token.go
mp/serve
* @Author: i@rysa.cn * @Date: 2022-05-14 16:48:14 * @LastEditTime: 2022-05-14 16:52:09 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\serve\serve.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:48:14 * @LastEditTime: 2022-05-14 16:52:09 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\serve\serve.go
mp/sns
* @Author: i@rysa.cn * @Date: 2022-05-14 16:53:24 * @LastEditTime: 2022-05-14 16:53:27 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\sns\sns.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:53:24 * @LastEditTime: 2022-05-14 16:53:27 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\sns\sns.go
mp/template_msg
* @Author: i@rysa.cn * @Date: 2022-06-02 14:56:06 * @LastEditTime: 2022-06-02 15:28:38 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\template_msg\template_msg.go
* @Author: i@rysa.cn * @Date: 2022-06-02 14:56:06 * @LastEditTime: 2022-06-02 15:28:38 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\mp\template_msg\template_msg.go
pay
* @Author: i@rysa.cn * @Date: 2022-05-14 17:02:20 * @LastEditTime: 2022-08-19 16:49:27 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\pay\app.go
* @Author: i@rysa.cn * @Date: 2022-05-14 17:02:20 * @LastEditTime: 2022-08-19 16:49:27 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\pay\app.go
utils
* @Author: i@rysa.cn * @Date: 2022-05-14 16:43:03 * @LastEditTime: 2022-05-14 16:46:52 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\utils\tools.go
* @Author: i@rysa.cn * @Date: 2022-05-14 16:43:03 * @LastEditTime: 2022-05-14 16:46:52 * @LastEditors: i@rysa.cn * @Description: * @FilePath: \go-utils\wechat\utils\tools.go

Jump to

Keyboard shortcuts

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