这是我参与「第五届青训营 」伴学笔记创作活动的第 2 天
1.GO三件套
- Gorm
- Kitex
- Hertz
2.三件套基础使用
GORM目前支持MySQL、SQL Server、PostgreSQL、 sQLite.
GOME的查询 删除 更新操作
使用First时,需要注意查询不到数据
会返回ErrRecordNotFound。
使用Find查询多条数据,
查询不到数
据不会返回错误。
使用Struct更新时,只会更
新非零值,如果需要更新零
值可以使用Map更新或使用
Select选择字段。
GORM提供了gorm.DeletedAt用于帮助用户实现软删
拥有软删除能力的Model调用Delete时,记录不会被
从数据库中真正删除。
但GORM会将DeletedAt置为当
前时间,
并且你不能再通过正常的查询方法找到该记录。
使用Unscoped可以查询到被软删的数据
GOME生态
GORM代码生成工具 github.com/go-gorm/gen
GORM分片库方案github.com/go-gorm/sha…
GORM手动索引github.com/go-gorm/hin…
GORM乐观锁github.com/go-gorm/opt…
GORM读写分离https:/github.com/go-gorm/dbresolver
GORMOpenTelemetry扩展github.com/go-gorm/ope…
Kitex
XDS扩展github.com/kitex-contr…
opentelemetry扩展https:/github.com/kitex-contrib/obs-opentelemetry
ETCD服务注册与发现扩展github.com/kitex-contr…
Nacos服务注册与发现扩展https:/github.com/kitex-contrib/registry-nacos
Zookeeper服务注册与发现扩展github.com/kitex-contr…
polaris扩展github.com/kitex-contr…
丰富的示例代码与业务Demo github.com/cloudwego/k…
Hertz
HTTP2扩展
github.com/hertz-contr…
github.com/hertz-contr…
国际化扩展
github.com/hertz-contr…
反向代理扩展github.com/hertz-contr…
JWT鉴权扩展github.com/hertz-contr…
Websocket扩展github.com/hertz-contr…
丰富的示例代码与业Demo https:/github.com/cloudwego/hertz-examples/