上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页
摘要: 编写注册函数 package utils import ( consulapi "github.com/hashicorp/consul/api" "log" ) func RegService() { config := consulapi.DefaultConfig() config.Address = "192.168.3.14:8500" re... 阅读全文
posted @ 2019-12-22 17:41 离地最远的星 阅读(1732) 评论(0) 推荐(0) 编辑
摘要: package main import ( httptransport "github.com/go-kit/kit/transport/http" mymux "github.com/gorilla/mux" "gomicro/Services" "net/http" ) func main() { user := Services.UserService{} ... 阅读全文
posted @ 2019-12-22 10:48 离地最远的星 阅读(1314) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑
摘要: set autocommit=0; //设置autocommit为0会取消自动提交 insert into topic_classes values(320,'火箭班','牛逼') --执行了这句话不执行commit并不会提交数据到数据库,只有在自己的会话中可以看到改变了,其实并没有真正的提交,新开一个会话会发现查询不到这个会话提交的内容,如果没有提交的话 COMMIT --执行这个才会把in... 阅读全文
posted @ 2019-12-20 01:00 离地最远的星 阅读(84) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页