# tools **Repository Path**: common_go/tools ## Basic Information - **Project Name**: tools - **Description**: tools - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-03-31 - **Last Updated**: 2024-11-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Tools 用户中台工具库 ## 安装 ```shell script go get gitee.com/common_go/tools ``` ## Address ```go import "gitee.com/common_go/tools/uAddress" // 获取IP ips, err := uAddress.IntranetIP() ``` ## Os ```go import "gitee.com/common_go/tools/uOs" // 判断文件是否存在 has, err := uOs.DirExists("/home/dev") ``` ## Rand ```go import "gitee.com/common_go/tools/uRand" // 生产 [100] 以内随机数 r := uRand.NewRandInt(1000) ``` ## Snowflake ### 初始化 ```go import "gitee.com/common_go/tools/uSnowflake" // 初始化,传递项目名称 uSnowflake.InitSnowflake("appName") ``` ### 示例 ```go import "gitee.com/common_go/tools/uSnowflake" // 生产雪花ID uSnowflake.NewIdInt64() uSnowflake.NewIdString() ``` ## Yach ```go import "gitee.com/common_go/tools/uYach" // 实例化对象 yach := NewYach("Mmlmd0t1SzV6cVNGU2VnS25HNmViT0d2dEZBT3oybk5LUFJyUCtnVSt6TFJLeERBUVkyWFJoaGxQWDZndE1sUg", "SEC3a459e5fcdb4fd14913b9ca194442d7c") // 发送消息 @所有人 msg := NewMsg().T("testing udcTools yach send at all...").AA() err := yach.Send(msg) if err != nil { t.Error("发送失败", err) } // 发送消息 @指定人 msg2 := NewMsg().T("testing udcTools yach send at wll ...").A([]string{"13020084949"}) err = yach.Send(msg2) if err != nil { t.Error("发送失败", err) } // 发送普通消息 msg3 := NewMsg().T("testing udcTools yach send at wll ...") err = yach.Send(msg3) if err != nil { t.Error("发送失败", err) } ```