go
runtoweb3
go,python ,php,mysql
展开
-
go获取运行内存
func PrintMemUsage() { var m runtime.MemStats runtime.ReadMemStats(&m) // For info on each, see: https://golang.org/pkg/runtime/#MemStats fmt.Printf("Alloc = %v MiB", bToMb(m.Alloc)) fmt.Printf("\tTotalAlloc = %v MiB", bToMb(m.TotalAlloc)) fmt.P.原创 2021-09-08 17:54:39 · 1653 阅读 · 0 评论 -
Go实现基本数据结构
利用 Redis 的 bitmap 实现简单的布隆过滤器go 实现单向链表go 实现冒泡排序和插入排序数据结构算法-go 实现二分法数据结构和算法-go 实现散列表 (HashTable)数据结构和算法-go 实现堆。。。原创 2020-07-23 16:57:21 · 278 阅读 · 0 评论 -
Go操作数据库
go提供了一些标准库让我们和数据库交互, database/sql是golang的标准库之一,它提供了一系列接口方法,用于访问关系数据库。 不同的数据库驱动,需要去实现各种方法func main(){ db,err := sql.Open("mysql", "root:123456@tcp(127.0.0.1:3306)/htadmin")}此时会报错,说mysql 驱动不存在。安装mysql驱动go get github.com/go-sql-driver/mysql--------原创 2020-06-01 12:13:40 · 833 阅读 · 1 评论 -
Go的类型-面向对象编程
# Go的类型-面向对象编程### 1.借助结构体来实现类的声明,比如声明一个学生类,就是创建一个结构体~~~gotype Student struct { id uint name string male bool score float64}func main() { stu := Student{1, "张三", true, 123}//...原创 2020-04-23 18:37:46 · 189 阅读 · 0 评论 -
go的第一个项目
1.首先下载二进制安装包,解压到/usr/local/目录下,解压后会有个go目录2.添加环境变量 vim /etc/profileexport GOROOT = /usr/local/go //go的安装路径export GOPATH = $HOME/goproject //go的项目路径,比如root用户 /root/goprojectexport GOBIN =...原创 2019-01-18 16:11:40 · 975 阅读 · 0 评论