摘要: package Services import ( "context" "fmt" "github.com/go-kit/kit/endpoint" ) type UserRequest struct { //封装User请求结构体,包含参数名和方法 Uid int `json:"uid"` Method string } type User... 阅读全文
posted @ 2019-12-21 11:56 离地最远的星 阅读(660) 评论(0) 推荐(0) 编辑
摘要: package main import ( httptransport "github.com/go-kit/kit/transport/http" "github.com/gorilla/mux" "gomicro/Services" "net/http" ) func main() { user := Services.UserService... 阅读全文
posted @ 2019-12-21 11:29 离地最远的星 阅读(725) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/go-kit/kit/transport/http" "gomicro/Services" ) func main() { user := Services.UserService{} endp := Services.GenUserEnPoint(user) http.NewServ... 阅读全文
posted @ 2019-12-21 11:09 离地最远的星 阅读(911) 评论(0) 推荐(0) 编辑
摘要: 第一步创建UserService package Services type IUserService interface { GetName(userid int) string } type UserService struct{} func (this UserService) GetName(userid int) string { if useri... 阅读全文
posted @ 2019-12-21 10:22 离地最远的星 阅读(1755) 评论(0) 推荐(0) 编辑
摘要: 首先你要知道; 无论是Myisam和Innodb引擎,如果在建表的时候没有显示的定义一行主键列的话,他内部都会自动创建一个隐藏的主键索引; 主键索引以外的索引假设称为次索引;首先Myisam和Innodb两个都是默认采用的btree索引,可以脑补一颗二叉树; myisam引擎的数据在物理磁盘上是按照 阅读全文
posted @ 2019-12-21 09:40 离地最远的星 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 将user_sys表分成3个区 id 6的 强制使用某一个分区去查询数据 我们按照主键值区间分区之后查询效率也会提升,因为查询数据时会到分区中查找,分区的数据比原来小很多,所以检索的速度会更加快,分区的时候还可以指定磁盘,这样从不同的磁盘读取数据,也减小了io的压力 还有hash分区和key分区自行了解来自为知笔记(Wiz) 阅读全文
posted @ 2019-12-21 09:37 离地最远的星 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 事务的四大特性 数据库事务 transanction 正确执行的四个基本要素。ACID,原子性(Atomicity)、一致性(Correspondence)、隔离性(Isolation)、持久性(Durability)。 (1)原子性:整个事务中的所有操作,要么全部完成,要么全部不完成,不可能停滞在中间某个环节。事务在执行过程中发生错误,会被回滚(Rollback)到事务开始前的状态,就像... 阅读全文
posted @ 2019-12-21 09:36 离地最远的星 阅读(3046) 评论(0) 推荐(2) 编辑