02 2021 档案
摘要:// 锁的当前锁对象 public synchronized void test(){ a++; } 等同于 public void test() { synchronized (this) { a++; } } // 加了static后锁的当前类的class public synchronized
阅读全文
摘要:select_type:SIMPLE 简单查询,MATERIALIZED 被处理的子查询 type:system > const > eq_ref>ref >range > index > all , 最好能优化到range级别或则ref级别 ALL 不使用索引,全局扫描 index 当查询的时候只
阅读全文
摘要:sharding: jdbc: config: sharding: tables: myorder: key-generator-column-name: id #主键 actual-data-nodes: db$->{0..1}.myorder_$->{0..1} #分库策略 database‐s
阅读全文
摘要:sharding: jdbc: config: sharding: tables: myorder: key-generator-column-name: id #主键 actual-data-nodes: db$->{0..1}.myorder_$->{0..1} #分库策略 database‐s
阅读全文
摘要:绑定表: 指分片规则一致的主表和子表。例如: t_order 表和 t_order_item 表,均按照 order_id 分片,绑定表之间的分区键完全相同,则此两张表互为绑定表关系。绑定表之间的多表关联查询不会出现笛卡尔积关联,关联查询效率将大大提升。举例说明,如果SQL为: SELECT i.*
阅读全文
摘要:1.下载第三方库:go get gopkg.in/gcfg.v1 2.创建conf.yaml文件 enabled: truepath: d:// 3.解析yaml的代码 package main import ( "fmt" "gopkg.in/yaml.v2" "io/ioutil" "log"
阅读全文
摘要:1.创建json配置文件 2.解析json配置文件 3.main方法 4.controller编写
阅读全文
摘要:scan goto scan是rows中有值的话继续读取
阅读全文
摘要:数据源1到2,t_order表1到2# 指定t_order表的数据分布情况,配置数据节点 spring.shardingsphere.sharding.tables.t_order.actual‐data‐nodes = m$->{1..2}.t_order_$‐>{1..2}
阅读全文
摘要:import lombok.Data; import java.util.ArrayList; import java.util.List; /** * @author huQi * @email * @data 2021/2/9 17:46 */ public class test { publi
阅读全文
摘要:使用gin提供的玩意`json:"别名"` package Module type ProdModel struct { ProdID int `json:"pId"` ProdName string `json:"pName"` }
阅读全文
摘要:1.服务提供者 // 数据模型 type ProdsRequest struct { Size int `form:"size"`} import ( "github.com/gin-gonic/gin" "github.com/micro/go-micro/registry" "github.co
阅读全文
摘要:下载插件 go get github.com/micro/go-plugins 导包 myhttp"github.com/micro/go-plugins/client/http"1.注册服务 import ( "github.com/gin-gonic/gin" "github.com/micro
阅读全文
摘要:import ( "fmt" "github.com/micro/go-micro/client/selector" "github.com/micro/go-micro/registry" "github.com/micro/go-plugins/registry/consul" "io/iout
阅读全文
摘要:1.服务注册 import ( "github.com/gin-gonic/gin" "github.com/micro/go-micro/registry" "github.com/micro/go-micro/web" "github.com/micro/go-plugins/registry/
阅读全文
摘要:windows在gitbash中输入,linux直接项目目录输入 go run *.go
阅读全文
摘要:package main import "strconv" type ProdModel struct { ProdID int ProdName string } func NewProd(id int,pName string) *ProdModel{ // 结构体变量声明方式1 /* var
阅读全文
摘要:# 以下是分片规则配置 # 定义数据源 spring.shardingsphere.datasource.names = m1 spring.shardingsphere.datasource.m1.type = com.alibaba.druid.pool.DruidDataSource spri
阅读全文
摘要:1.声明bean可以重复定义 spring.main.allow-bean-definition-overriding=true 2.数据库和bean映射驼峰命名 mybatis.configuration.map-underscore-to-canel-case=true
阅读全文
摘要:micro new --gopath=false hello
阅读全文
摘要:<!--引入AOP依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> 创建注解类 import ja
阅读全文
摘要:import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.IOException;
阅读全文