utils

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 2 Imported by: 4

README

Utils

一、这是什么

整个工具库比较通用的、基础的工具方法会下沉到这里

二、安装依赖

go get -u github.com/storage-lock/go-utils

三、API示例

3.1 utils.RandomID

package main

import (
	"fmt"
	"github.com/storage-lock/go-utils"
)

func main() {

	// 生成一个随机的ID
	id := utils.RandomID()
	fmt.Println(id)
	// Output:
	// bd75553a04c9413c8550702c23026662

	// 生成一个随机ID,拼接给定的前缀
	id = utils.RandomID("foo-prefix-")
	fmt.Println(id)
	// Output:
	// foo-prefix-fcc5cec3599a4539abc7eebabc4491b4

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomID

func RandomID(prefix ...string) string

RandomID 生成一个随机的ID,如果指定了前缀的话,则拼接给定前缀到ID

Types

This section is empty.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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