上一页 1 2 3 4 5 6 7 8 9 ··· 16 下一页
摘要: 我需要获取2021年1月份的日历盘信息,但是我需要的是第一个日历盘是2020年12月28日。以下代码就是我获取时间 import datetime, calendar # 当前时间所在的月的日历盘的第一个盒子和当前时间所在的盒子 def timestamp(): # 获取当前时间 current = 阅读全文
posted @ 2021-02-03 21:55 巫小诗 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 自定义表名 type User struct{ Id int Name string } // 自定义表名 func (User) TableName() string { return "test_user" } 给默认表名加前缀或者后缀 gorm.DefaultTableNameHanlder 阅读全文
posted @ 2021-02-01 23:10 巫小诗 阅读(8991) 评论(0) 推荐(0) 编辑
摘要: 导包 import ( "fmt" "github.com/gin-gonic/gin" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" ) 连接数据库 db,err := gorm.Open("mysql","r 阅读全文
posted @ 2021-02-01 22:21 巫小诗 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 下载 gorm go get github.com/jinzhu/gorm 导包 ,包前面的 _ 代表不需要校验的意思 import ( "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" ) 连接数据库 user:p 阅读全文
posted @ 2021-01-31 20:29 巫小诗 阅读(574) 评论(0) 推荐(0) 编辑
摘要: 绑定 form 或者 querystring 使用 结构体 type User struct{ Name string `form:"name"` Age int `form:"age"` } 后端代码 func ShouleBindAddForm(ctx *gin.Context){ var us 阅读全文
posted @ 2021-01-31 12:29 巫小诗 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 单文件上传 后端代码 使用 FormFile(key) 接收前端传的参数 使用SaveUploadFile(句柄,目标地址) // 生成文件名称 func generate_filename() string{ return strconv.FormatInt(time.Now().Unix(),1 阅读全文
posted @ 2021-01-30 21:46 巫小诗 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 1.在系统环境变量中 GOROOT 值为 C:\Go ,并保存 2.将GOROOT 添加到环境变量中,并保存 3.使用 mod # 初始化 mod go mod init 项目名称 # 指定gin的版本 go mod edit -require github.com/gin-gonic/gin@la 阅读全文
posted @ 2021-01-26 19:00 巫小诗 阅读(215) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: UTF-8 -*- ''' @Project -> File :MyDjango -> cos_upload_demo @IDE :PyCharm @Author :ruochen @Date :2020/7/17 11:52 @Desc : @Install: pip 阅读全文
posted @ 2021-01-07 13:45 巫小诗 阅读(368) 评论(0) 推荐(0) 编辑
摘要: Vue中 格式化 json 数据 安装 vue-json-viewer npm install vue-json-viewer --save 在 main.js 中配置 // json格式化显示 import JsonViewer from 'vue-json-viewer' Vue.use(Jso 阅读全文
posted @ 2020-12-25 13:45 巫小诗 阅读(3368) 评论(0) 推荐(0) 编辑
摘要: SQLAlchemy 创建基类 from sqlalchemy.ext.declarative import declarative_base # 基类 Base = declarative_base() 创建 session 会话 from sqlalchemy import create_eng 阅读全文
posted @ 2020-12-15 18:01 巫小诗 阅读(100) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 16 下一页