Fork me on GitHub
摘要: 3.gin数据解析和 绑定 3.1 Json 数据解析和绑定 客户端传参,后端接收并解析到结构体 package main import ( "github.com/gin-gonic/gin" "net/http" ) type Login struct { // binding:"require 阅读全文
posted @ 2020-07-19 22:26 是阿凯啊 阅读(771) 评论(0) 推荐(0) 编辑
摘要: 1.gin简介 镜像配置: // 安装出现timeout问题可以配置go module镜像,终端执行下面命令,为阿里镜像 go env -w GO111MODULE=on go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct 安装g 阅读全文
posted @ 2020-07-19 22:25 是阿凯啊 阅读(359) 评论(0) 推荐(0) 编辑
摘要: 5.并发编程 5.1并发介绍 5.1.1并发与并行 多线程程序在一个核的cpu上运行,就是并发。 多线程程序在多个核的cpu上运行,就是并行。 5.1.2协程 协程独立的栈空间,并共享堆空间,调度由用户自己控制,本质上类似于用户级县城 Goroutine 由官方实现的超级“线程池”。 5.2 Gor 阅读全文
posted @ 2020-07-19 22:19 是阿凯啊 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 3.网络编程 3.1.TCP编程 server package main import ( "bufio" "fmt" "net" ) func process(conn net.Conn) { defer conn.Close() for { // 接收数据 reader := bufio.New 阅读全文
posted @ 2020-07-19 22:04 是阿凯啊 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 2.接口 接口定义了一个对象的行为规范。 2.1接口 2.1.1接口类型 Go语言中接口是一种类型,一种抽象类型。 interface是一组methods的集合。 2.1.2为什么要用接口 package main import "fmt" type Cat struct{} func (c Cat 阅读全文
posted @ 2020-07-19 22:01 是阿凯啊 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 1.面向对象 1.1匿名字段 package main import "fmt" type Person struct { name string sex string age int } type Student struct { Person id int addr string } func 阅读全文
posted @ 2020-07-19 21:59 是阿凯啊 阅读(108) 评论(0) 推荐(0) 编辑