摘要:package main // 声明 main 包,表明当前是一个可执行程序 import "fmt" // 导入内置 fmt import "os" // 导入内置 fmt // 定义变量 var ( a int = 2 b string = "bb" ) // 定义常量 const ( c in
阅读全文
摘要://密码强度必须为字⺟⼤⼩写+数字+符号,8位以上 func CheckPasswordLever(ps string) error { if len(ps) < 8 { return fmt.Errorf("password len is < 9") } num := `[0-9]{1}` a_z
阅读全文
摘要:一下列出了部分内容,详情可以查看官方文档,官方文档路径: https://gorm.io/zh_CN/docs/ https://www.kancloud.cn/sliver_horn/gorm/1861152 package main import ( "fmt" "strconv" "time"
阅读全文
摘要:package main import ( "fmt" "strconv" "time" _ "github.com/go-sql-driver/mysql" "gorm.io/driver/mysql" "gorm.io/gorm" ) //定义一个结构体,gorm允许定义结构体的时候通过tag定
阅读全文
摘要:本博客转自:https://www.cnblogs.com/nyist-xsk/p/11448348.html package main import ( "log" "time" ) func main() { t := int64(1546926630) //外部传入的时间戳(秒为单位),必须为
阅读全文
摘要:package main import ( "database/sql/driver" "fmt" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" ) type student struct { Name string Age
阅读全文
摘要:package main import ( "database/sql/driver" "fmt" "strings" "time" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" ) type user struct { I
阅读全文
摘要:package main import ( "fmt" "time" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" ) type user struct { Id int Name string // 首字母大写,不然后面的
阅读全文
摘要: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
阅读全文