Documentation
¶
Index ¶
- Constants
- func DiffNatureDays(t1, t2 int64) int
- func Div(Num int) string
- func DockerRunCommand(command string) (err error)
- func Float64(any interface{}) float64
- func InArray(value string, arr []string) bool
- func Int(any interface{}) int
- func Int64(any interface{}) int64
- func IsValidIP(ip string) bool
- func LeDecodeToFloat64(b []byte) float64
- func LeFillUpSize(b []byte, l int) []byte
- func LogField(err error, msg string) log.Fields
- func Md5(str string) string
- func PathExists(path string) (bool, error)
- func ReserveNumber(f float64, m int) string
- func Round(f float64, n int) float64
- func RunCommand(name string, arg ...string) (err error)
- func String(any interface{}) string
- func UnExt(fileName string) string
- func UnzipDir(zipFile, dir string)
- func VersionCompare(v1, v2 string) (res bool)
- func WriteFile(fileName, s string) (err error)
- type Host
Constants ¶
View Source
const ( ErrCode = 1 ModuleCode = 100 * ErrCode ServerCode = ModuleCode * 100 )
错误代码100101,其中 10 代表发布平台服务;中间的 01 代表发布平台服务下的文章模块;最后的 01 代表模块下的错误码序号,每个模块可以注册 100 个错误 0代表成功
View Source
const ( ServerPublishCode = 25 * ServerCode //发布平台 ServerStatisticCode = 26 * ServerCode //统计服务 )
服务代码
View Source
const ( PublishArticleCode = 1 * ModuleCode //文章模块 PublishFileCode = 2 * ModuleCode //文件模块 PublishNotificationCode = 3 * ModuleCode //通知模块 )
发布平台相关模块
View Source
const ( PublishArticlePublishFailed = 1 * ErrCode //发布失败 PublishArticleSaveFailed = 2 * ErrCode //保存失败 PublishArticleUploadFailed = 3 * ErrCode //上传文件失败 PublishArticleDeleteFailed = iota + 1 //文章删除失败 4 PublishArticleQueryFailed //查询失败 5 PublishArticlePushNoticeCreateFailed //推送通知创建失败 6 PublishArticleListStandard //查询行业规范列表失败 7 PublishArticleDeleteArticleBatch //批量删除文章失败 8 PublishArticleDeleteArticle //删除文章失败 9 PublishArticleEditArticle //编辑文章失败 10 )
发布平台文章模块错误码
Variables ¶
This section is empty.
Functions ¶
func DiffNatureDays ¶
DiffNatureDays
@description: 两个日期的相差的自然天数 @param: @author: GJing @email: gjing1st@gmail.com @date: 2022/11/16 11:22 @success:
func DockerRunCommand ¶ added in v1.1.0
DockerRunCommand @description: docker容器执行宿主机指令 @param: @author: GJing @email: gjing1st@gmail.com @date: 2023/2/11 13:46 @success:
func Float64 ¶
func Float64(any interface{}) float64
Float64
@description: 接口类型转float64 @param: any 接口类型 @author: GJing @email: gjing1st@gmail.com @date: 2022/4/22 10:44 @success: float64
func InArray ¶
InArray
@description: 判断一个字符串是否在数组中 @param: @author: GJing @email: gjing1st@gmail.com @date: 2020/11/13 14:42 @success:
func Int ¶
func Int(any interface{}) int
Int
@description: 转int @param: @author: GJing @email: gjing1st@gmail.com @date: 2022/4/22 11:13 @success:
func Int64 ¶
func Int64(any interface{}) int64
Int64
@description: 接口类型转int64 @param: any 接口类型 @author: GJing @email: gjing1st@gmail.com @date: 2022/4/22 10:56 @success: int64
func IsValidIP ¶ added in v1.1.0
IsValidIP @Description 验证IP是否有效 @params @contact.name GJing @contact.email gjing1st@gmail.com @date 2023/6/12 18:41
func LeDecodeToFloat64 ¶
func LeFillUpSize ¶
func LogField ¶
LogField
@description: 日志字段 @param: @author: GJing @email: gjing1st@gmail.com @date: 2022/11/1 15:35 @success:
func PathExists ¶
PathExists
@description: 判断文件是否存在 @param: @author: Zq @email: zhengqiang@tna.cn @date: 2022/10/19 17:52 @success:
func ReserveNumber ¶
ReserveNumber
@description: 截取保留小数点后m位,舍去后面位数 @param: f float64 @param: m 保留的位数 @author: GJing @email: gjing1st@gmail.com @date: 2020/11/25 上午 10:31 @success: 返回截取后的字符串
func Round ¶
Round
@description: 四舍五入保留n位小数 @param:f 需要处理的float数 @param:n 需要保留的小数位数 @author: GJing @email: gjing1st@gmail.com @date: 2021/1/23 10:36 @success:
func RunCommand ¶
RunCommand
@description: 运行系统命令 @param: cmdStr 要运行的命令 @author: GJing @email: gjing1st@gmail.com @date: 2022/9/2 17:46 @success:
func String ¶
func String(any interface{}) string
String
@description: 转string类型 @param: any 接口类型 @author: GJing @email: gjing1st@gmail.com @date: 2022/4/22 11:11 @success: 字符串
func UnExt ¶
UnExt
@description: 返回文件名称去掉后缀和最后一个`.` @param: fileName 文件名称 @author: GJing @email: gjing1st@gmail.com @date: 2022/7/28 15:39 @success:
func UnzipDir ¶
func UnzipDir(zipFile, dir string)
UnzipDir
@description: 解压缩 @param:zipFile 压缩文件路径 ./test.zip @param:dir 需要解压到的指定文件夹目录 ex :F:\dumps_copy @author: GJing @email: gjing1st@gmail.com @date: 2021/1/13 15:19 @success:
func VersionCompare ¶ added in v1.1.0
VersionCompare @description: 版本比较,v2版本是否大于v1版本 @param: v1 string 当前版本 @param: v2 string 最新版本 @author: GJing @email: gjing1st@gmail.com @date: 2023/2/16 14:41 @success: v2>v1返回true
Types ¶
Click to show internal directories.
Click to hide internal directories.