摘要:
不定参数函数 在Go语言中,能够传递可变数量的参数,但它们的类型必须与函数签名指定的类型相同。要指定不定参数,可使用3个点(…) demo package main import "fmt" // 数字求和函数 不定参数 func AddNumbers(numbers ...int) (sum in
阅读全文
posted @ 2021-06-30 23:38
新Sir
阅读(468)
推荐(0)
摘要:
多态就是多重形态。 案例: 收入的案例: package main import ( "fmt" ) type Income interface { calculate () float64 source() string } //固定账单项目 type FixedBuilding struct {
阅读全文
posted @ 2021-06-27 21:39
新Sir
阅读(1343)
推荐(0)
摘要:
参考:https://blog.csdn.net/php_lzr/article/details/98853027 重复数据处理 场景一:这种方法只是统计了该字段重复对应的具体的个数 列出字段重复的数据 例子: 如图数据表 有重复数据,列出 title 有重复的数据 SELECT title,COU
阅读全文
posted @ 2021-03-17 17:54
新Sir
阅读(55)
推荐(0)
摘要:
v_jsonchang@v_jsonchan-PC1 MINGW64 /f $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 63623021f5c1 mysql "docker-entrypoint.s…" 5 mo
阅读全文
posted @ 2021-03-12 17:24
新Sir
阅读(225)
推荐(0)
摘要:
golang 包 "github.com/didi/gendry/builder 的使用 撸代码 dao.go package dao import ( "errors" "github.com/didi/gendry/builder" "viper_demo/dabasepool" ) const
阅读全文
posted @ 2021-03-09 17:00
新Sir
阅读(580)
推荐(0)
摘要:
golang myslq 连接池的思路学习练习【思路篇】 main.go package main import ( "fmt" "viper_demo/dabasepool" ) //写一个查询函数,使用数据库的函数 func Searchtest() { var Id int64 var Tit
阅读全文
posted @ 2021-03-09 16:14
新Sir
阅读(219)
推荐(0)
摘要:
代 package main import ( "fmt" "github.com/fsnotify/fsnotify" "github.com/gin-gonic/gin" "github.com/spf13/viper" "net/http" ) func main() { //viper.Se
阅读全文
posted @ 2021-03-08 23:06
新Sir
阅读(1226)
推荐(0)
摘要:
连接mysql、增删改查示例 package main import ( "fmt" "github.com/jinzhu/gorm" _"github.com/jinzhu/gorm/dialects/mysql" // 这里没有直接使用,匿名导入 ) type User struct { //g
阅读全文
posted @ 2021-03-01 10:24
新Sir
阅读(275)
推荐(0)
摘要:
package main import ( "fmt" "github.com/gin-gonic/gin" "net/http" "time" ) type Student struct { Name string `json:"name"` Country string `json:"count
阅读全文
posted @ 2021-02-26 16:14
新Sir
阅读(179)
推荐(0)
摘要:
package main import ( "github.com/gin-gonic/gin" "log" "net/http" ) type Info struct { Name string `json:"name"` // 结构标签是的名称是 http 发送请求的时候的 key 的名字, 要
阅读全文
posted @ 2021-02-26 09:49
新Sir
阅读(191)
推荐(0)