go_utils

package module
v0.2.6 Latest Latest
Warning

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

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