go

Go strings.HasPrefix函数

描述 strings.HasPrefix函数用来检测字符串是否以指定的前缀开头。 语法 需要导入 strings包 strings.Hasprefix(s, prefix) 参数 参数 说明 备注 s 待检测的字符串 字符串类型的参数 prefix 指定的...

golang 前补0

func StrPad( str int64, index int) string { ending := strconv.FormatInt(str, 10) switch { case len(ending) index: return fmt.Sprintf("%."+fmt.Sprintf("%vs", index), ending[len(ending)-...

Golang如何获取当前年份月份日

众所周知Golang的时间格式化很奇葩 date := time.Now().Format("2006-01-02 15:04:05") 只有写以上参数才可获得对应的时间格式,所以我们也可以利用这个方法获取当前时间的年月日时分秒 year:=time....

mac上brew安装grpc

grpc安装 brew install grpc brew install protobuf brew install protoc-gen-go brew install protoc-gen-go-grpc 检查: go-version protoc --version protoc-gen-go --version 安装...

casbin的表字段解释

casbin_rule表中 p_type --类型,可以是p策略,g角色等等 v0 --角色 roleName/roleId sub v1 --Path 路径 obj v2 --Method 请求方式 act v3 --允许读/写 read/write ...

Goland配置goproxy.cn代理

打开Goland软件,可以看到如下菜单。 选中File菜单,在弹出的菜单列表中,选中Settings选项。进入Settings界面 注意上图圈起来的两处: 1、勾选Enable Go Modules integration.(必须) 2、设置...