随笔分类 -  go

golang学习--字符串格式化
摘要:package main // 声明 main 包,表明当前是一个可执行程序 import "fmt" // 导入内置 fmt import "os" // 导入内置 fmt // 定义变量 var ( a int = 2 b string = "bb" ) // 定义常量 const ( c in 阅读全文

posted @ 2022-05-23 21:58 torotoise512 阅读(707) 评论(0) 推荐(0) 编辑

Golang密码复杂度校验
摘要://密码强度必须为字⺟⼤⼩写+数字+符号,8位以上 func CheckPasswordLever(ps string) error { if len(ps) < 8 { return fmt.Errorf("password len is < 9") } num := `[0-9]{1}` a_z 阅读全文

posted @ 2021-09-22 20:44 torotoise512 阅读(681) 评论(0) 推荐(0) 编辑

GORM的增删改查
摘要:一下列出了部分内容,详情可以查看官方文档,官方文档路径: https://gorm.io/zh_CN/docs/ https://www.kancloud.cn/sliver_horn/gorm/1861152 package main import ( "fmt" "strconv" "time" 阅读全文

posted @ 2021-09-21 16:20 torotoise512 阅读(277) 评论(0) 推荐(0) 编辑

GORM:创建数据
摘要:package main import ( "fmt" "strconv" "time" _ "github.com/go-sql-driver/mysql" "gorm.io/driver/mysql" "gorm.io/gorm" ) //定义一个结构体,gorm允许定义结构体的时候通过tag定 阅读全文

posted @ 2021-09-21 12:46 torotoise512 阅读(375) 评论(0) 推荐(0) 编辑

golang的time包:时间字符串和时间戳的相互转换
摘要:本博客转自:https://www.cnblogs.com/nyist-xsk/p/11448348.html package main import ( "log" "time" ) func main() { t := int64(1546926630) //外部传入的时间戳(秒为单位),必须为 阅读全文

posted @ 2021-09-21 10:53 torotoise512 阅读(898) 评论(0) 推荐(0) 编辑

GO操作数据库3【学习自李文周老师博客】
摘要:package main import ( "database/sql/driver" "fmt" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" ) type student struct { Name string Age 阅读全文

posted @ 2021-09-20 20:07 torotoise512 阅读(73) 评论(0) 推荐(0) 编辑

GO操作数据库2【学习自李文周老师博客】
摘要:package main import ( "database/sql/driver" "fmt" "strings" "time" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" ) type user struct { I 阅读全文

posted @ 2021-09-20 20:00 torotoise512 阅读(75) 评论(0) 推荐(0) 编辑

GO操作数据库1【学习自李文周老师博客】
摘要:package main import ( "fmt" "time" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" ) type user struct { Id int Name string // 首字母大写,不然后面的 阅读全文

posted @ 2021-09-20 18:13 torotoise512 阅读(110) 评论(0) 推荐(0) 编辑

go调用mysql
摘要:package main import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" ) func main() { db, err := sql.Open("mysql", "root:123456@(127.0.0.1:330 阅读全文

posted @ 2021-09-20 16:08 torotoise512 阅读(22) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示