随笔分类 -  golang

摘要: 阅读全文
posted @ 2021-06-08 15:44 尘归风 阅读(140) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "log" 5 _ "github.com/go-sql-driver/mysql" 6 "github.com/jmoiron/sqlx" // 驱动 7 ) 8 9 type Class struct { 10 Id int64 11 阅读全文
posted @ 2020-02-05 00:06 尘归风 阅读(385) 评论(0) 推荐(0)
摘要:煎鱼大佬的教程 app.ini #debug or release RUN_MODE = debug [app] PAGE_SIZE = 10 JWT_SECRET = 23347$040412 [server] HTTP_PORT = 8000 READ_TIMEOUT = 60 WRITE_TI 阅读全文
posted @ 2020-01-27 16:28 尘归风 阅读(516) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "net/http" 5 "github.com/gin-gonic/gin" 6 ) 7 8 func main() { 9 r := gin.Default() 10 11 r.GET("/someDataFromReader", fu 阅读全文
posted @ 2020-01-16 21:29 尘归风 阅读(506) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "fmt" 5 "net/http" 6 "path/filepath" 7 8 "github.com/gin-gonic/gin" 9 ) 10 11 func main() { 12 r := gin.Default() 13 // 阅读全文
posted @ 2020-01-16 20:06 尘归风 阅读(1016) 评论(0) 推荐(0)
摘要:1 package main 2 3 import "fmt" 4 5 type Human struct { 6 name string 7 age int 8 phone string 9 } 10 11 type Student struct { 12 Human //匿名字段 13 scho 阅读全文
posted @ 2019-12-20 22:08 尘归风 阅读(540) 评论(0) 推荐(0)
摘要:package main import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" ) func main() { db, err := sql.Open("mysql", "root:root@/test?charset=ut 阅读全文
posted @ 2019-12-20 00:15 尘归风 阅读(376) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "flag" 5 "fmt" 6 "os" 7 ) 8 9 var ( 10 h bool 11 v, V bool 12 t, T bool 13 q *bool 14 s string 15 p string 16 c string 1 阅读全文
posted @ 2019-12-12 15:56 尘归风 阅读(443) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2019-12-12 00:58 尘归风 阅读(283) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "context" 5 "fmt" 6 "time" 7 ) 8 9 var key string = "name" 10 11 func main() { 12 ctx, cancel := context.WithCancel(cont 阅读全文
posted @ 2019-12-11 21:45 尘归风 阅读(784) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "bufio" 5 "fmt" 6 "os" 7 ) 8 9 func main() { 10 w := bufio.NewWriter(os.Stdout) 11 fmt.Fprint(w, "Hello, ") 12 fmt.Fprin 阅读全文
posted @ 2019-12-10 11:51 尘归风 阅读(527) 评论(0) 推荐(0)
摘要:tar 打包 1 package main 2 3 import ( 4 "archive/tar" 5 "io" 6 "log" 7 "os" 8 ) 9 10 func main() { 11 dst := "C:/Users/xxc/Desktop/task/github/exercise/g 阅读全文
posted @ 2019-12-09 22:22 尘归风 阅读(571) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2019-12-06 00:28 尘归风 阅读(101) 评论(0) 推荐(0)
摘要:二叉树 1 package main 2 3 import "fmt" 4 5 type node struct { 6 val int 7 left *node 8 right *node 9 } 10 11 type btree struct { 12 root *node 13 } 14 15 阅读全文
posted @ 2019-12-03 15:35 尘归风 阅读(429) 评论(0) 推荐(0)
摘要:go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.cn,direct 阅读全文
posted @ 2019-12-02 20:03 尘归风 阅读(139) 评论(0) 推荐(0)
摘要:深度解密Go语言之map 深度解密Go语言之Slice 深度解密Go语言之channel 深度解密Go语言之context 深度解密Go语言之unsafe Go 创建对象时,如何优雅的传递初始化参数 阅读全文
posted @ 2019-12-02 12:12 尘归风 阅读(137) 评论(0) 推荐(0)
摘要:实现动态二位数组 阅读全文
posted @ 2019-12-01 23:52 尘归风 阅读(113) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2019-12-01 16:05 尘归风 阅读(104) 评论(0) 推荐(0)
摘要:数据绑定和解析 1 package main 2 3 import ( 4 "net/http" 5 6 "github.com/gin-gonic/gin" 7 ) 8 9 type Login struct { 10 User string `form: "username" json: "us 阅读全文
posted @ 2019-11-28 12:22 尘归风 阅读(245) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "net/http" 5 6 "github.com/gin-gonic/gin" 7 ) 8 9 func main() { 10 // Creates a gin router with default middleware: 11 / 阅读全文
posted @ 2019-11-27 22:40 尘归风 阅读(395) 评论(0) 推荐(0)