随笔分类 - golang
摘要: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
阅读全文
摘要:煎鱼大佬的教程 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
阅读全文
摘要: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
阅读全文
摘要: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 //
阅读全文
摘要: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
阅读全文
摘要:package main import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" ) func main() { db, err := sql.Open("mysql", "root:root@/test?charset=ut
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:二叉树 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
阅读全文
摘要:go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.cn,direct
阅读全文
摘要:深度解密Go语言之map 深度解密Go语言之Slice 深度解密Go语言之channel 深度解密Go语言之context 深度解密Go语言之unsafe Go 创建对象时,如何优雅的传递初始化参数
阅读全文
摘要:数据绑定和解析 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
阅读全文
摘要: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 /
阅读全文

浙公网安备 33010602011771号