11 2023 档案
摘要:一. 初始化连接 1 package model 2 3 import ( 4 "fmt" 5 6 "gorm.io/driver/mysql" 7 "gorm.io/gorm" 8 ) 9 10 /*** 11 Navicat 数据库可视化工具: https://www.navicat.com/e
阅读全文
摘要:一. Cookie 1 func (con UserControl) Index(c *gin.Context) { 2 /*** 设置Cookie 3 func (c *Context) SetCookie(name, value string, maxAge int, path, domain
阅读全文
摘要:一.中间件 1 package main 2 3 import ( 4 "fmt" 5 "gin01/middlewares" 6 "text/template" 7 "time" 8 9 "github.com/gin-gonic/gin" 10 ) 11 12 /*** 13 中间件的注意事项:
阅读全文
摘要:一. 请求参数的获取值 动态路由 1 type User struct { 2 Username string `form:"username" json:"username"` 3 Password string `form:"password" json:"password"` 4 Age in
阅读全文
摘要:一, 模板定义,模板变量,条件判断,模板函数,模板命名 1 {{define "default/index.html"}} 2 <!DOCTYPE html> 3 <html lang="en"> 4 5 <head> 6 <meta charset="UTF-8"> 7 <meta name="v
阅读全文
摘要:1.Gin框架搭建,初识 1 // main.go 2 package main 3 4 /*** 5 Gin入门: 6 文档: https://gin-gonic.com/zh-cn/docs/quickstart/ 7 热加载: 8 文档: https://github.com/cosmtrek
阅读全文
摘要:一丶Redis 1 package redis_test 2 3 import ( 4 "fmt" 5 6 "github.com/gomodule/redigo/redis" 7 ) 8 9 // 安装 10 // go get github.com/gomodule/redigo/redis 1
阅读全文