Documentation
¶
Index ¶
- Constants
- func BigIntToIP(i *big.Int) net.IP
- func CalculateCIDR(startIP, endIP string) (string, error)
- func CopyToClipboardUseOsc52(str string) error
- func DeepCopy(value any) any
- func DeleteSelf()
- func Duration2String(t time.Duration, secondPrecision ...string) string
- func FindMissingNumbers(numbers []int) []int
- func GetGitBranchHash(url, branch string) (string, error)
- func Getenv(key string, defaultValue string) string
- func GroupNumbers(numbers []int, groupSize int) [][]int
- func IpToBigInt(ip net.IP) *big.Int
- func IsProcessExist(pid string) bool
- func RandomPort(start, end uint16) uint16
- func Sha256(data []byte) []byte
- func TimeToPrt(t time.Time) *time.Time
- func Try(fn func()) (t *try)
- func UniqueArray[T any, N any](data []N, f func(N) T) []T
- type FileInfo
- type Num
- type Snowflake
Constants ¶
View Source
const MaxPort uint16 = 1<<16 - 1
Variables ¶
This section is empty.
Functions ¶
func CalculateCIDR ¶ added in v0.1.7
CIDR 计算
func CopyToClipboardUseOsc52 ¶ added in v0.1.7
func DeleteSelf ¶
func DeleteSelf()
func Duration2String ¶ added in v0.1.7
func FindMissingNumbers ¶ added in v0.1.7
FindMissingNumbers 寻找连续数字中的空缺数字
func GetGitBranchHash ¶
func GroupNumbers ¶ added in v0.1.7
GroupNumbers 将连续数字进行分组 numbers 输入数字 groupSize 每组最多容纳数字个数,当groupSize <= 0时不做限制
func IsProcessExist ¶
func UniqueArray ¶ added in v0.1.7
UniqueArray 输出唯一数组
Types ¶
type FileInfo ¶
type FileInfo struct {
Name string `json:"name"`
Path string `json:"path"`
Sha string `json:"sha"`
Size int `json:"size"`
Url string `json:"url"`
HtmlUrl string `json:"html_url"`
GitUrl string `json:"git_url"`
DownloadUrl string `json:"download_url"`
Type string `json:"type"`
Content string `json:"content"`
Encoding string `json:"encoding"`
Links struct {
Self string `json:"self"`
Git string `json:"git"`
Html string `json:"html"`
} `json:"_links"`
}
func GetGitHubFileInfo ¶
type Snowflake ¶ added in v0.1.7
type Snowflake struct {
// 基准时间
BaseTime time.Time
// 逻辑id,可以是部署的机器id
LogicalId int64
// 所有bit总和不能超过64
// 毫秒时间所占长度,默认41bit 大概可以在基准时间上用69年左右
BaseTimeBit int64
// 默认13bit
LogicalIdBit int64
// 自增序列,默认10bit
AutoIncrementBit int64
// contains filtered or unexported fields
}
func (*Snowflake) GenerateId ¶ added in v0.1.7
Source Files
¶
Click to show internal directories.
Click to hide internal directories.