7 days golang programs from scratch (web framework Gee, distributed cache GeeCache, object relational mapping ORM framework GeeORM, rpc framework GeeRPC etc) 7天用Go动手写/从零实现系列
7天能写什么呢?类似 gin 的 web 框架?类似 groupcache 的分布式缓存?或者一个简单的 Python 解释器?希望这个仓库能给你答案。
推荐先阅读 Go 语言简明教程,一篇文章了解Go的基本语法、并发编程,依赖管理等内容。
推荐 Go 语言笔试面试题,加深对 Go 语言的理解。
推荐 Go 语言高性能编程(项目地址),写出高性能的 Go 代码。
Gee 是一个模仿 gin 实现的 Web 框架,Go Gin简明教程可以快速入门。
GeeCache 是一个模仿 groupcache 实现的分布式缓存系统
GeeORM 是一个模仿 gorm 和 xorm 的 ORM 框架
gorm 准备推出完全重写的 v2 版本(目前还在开发中),相对 gorm-v1 来说,xorm 的设计更容易理解,所以 geeorm 接口设计上主要参考了 xorm,一些细节实现上参考了 gorm。
GeeRPC 是一个基于 net/rpc 开发的 RPC 框架
GeeRPC 是基于 Go 语言标准库 net/rpc
实现的,添加了协议交换、服务注册与发现、负载均衡等功能,代码约 1k。
具体的实践过程记录在 Go WebAssembly 简明教程。
What can be accomplished in 7 days? A gin-like web framework? A distributed cache like groupcache? Or a simple Python interpreter? Hope this repo can give you the answer.
GeeCache is a groupcache-like distributed cache
GeeORM is a gorm-like and xorm-like object relational mapping library
Xorm's desgin is easier to understand than gorm-v1, so the main designs references xorm and some detailed implementions references gorm-v1.
GeeRPC is a net/rpc-like RPC framework
Based on golang standard library net/rpc
, GeeRPC implements more features. eg, protocol exchange, service registration and discovery, load balance, etc.