{"id":13416666,"url":"https://github.com/geektutu/7days-golang","last_synced_at":"2025-05-13T19:02:59.774Z","repository":{"id":37296518,"uuid":"201658460","full_name":"geektutu/7days-golang","owner":"geektutu","description":"7 days golang programs from scratch (web framework Gee, distributed cache GeeCache, object relational mapping ORM framework GeeORM, rpc framework GeeRPC etc)  7天用Go动手写/从零实现系列","archived":false,"fork":false,"pushed_at":"2024-07-19T01:50:47.000Z","size":1031,"stargazers_count":15978,"open_issues_count":52,"forks_count":2497,"subscribers_count":233,"default_branch":"master","last_synced_at":"2025-04-27T08:34:49.797Z","etag":null,"topics":["golang","learning","scratch","starter-project"],"latest_commit_sha":null,"homepage":"https://geektutu.com/post/gee.html","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geektutu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-10T16:57:19.000Z","updated_at":"2025-04-27T08:12:54.000Z","dependencies_parsed_at":"2023-01-31T02:15:57.970Z","dependency_job_id":"bb15257b-1087-4fb2-abe7-2de1e77a885c","html_url":"https://github.com/geektutu/7days-golang","commit_stats":{"total_commits":127,"total_committers":7,"mean_commits":"18.142857142857142","dds":0.5118110236220472,"last_synced_commit":"cf3644382101dc13e7fd92e8f5c66cabc51bcd3b"},"previous_names":["geektutu/7days-gee-golang-web"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geektutu%2F7days-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geektutu%2F7days-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geektutu%2F7days-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geektutu%2F7days-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geektutu","download_url":"https://codeload.github.com/geektutu/7days-golang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010792,"owners_count":21998993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","learning","scratch","starter-project"],"created_at":"2024-07-30T22:00:18.965Z","updated_at":"2025-05-13T19:02:59.753Z","avatar_url":"https://github.com/geektutu.png","language":"Go","funding_links":[],"categories":["HarmonyOS","Popular","Go","文档","Documentation","编程语言"],"sub_categories":["Windows Manager","组织","To Organize","Golang"],"readme":"# 7 days golang programs from scratch\n\n[![CodeSize](https://img.shields.io/github/languages/code-size/geektutu/7days-golang)](https://github.com/geektutu/7days-golang)\n[![LICENSE](https://img.shields.io/badge/license-MIT-green)](https://mit-license.org/)\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eREADME 中文版本\u003c/strong\u003e\u003c/summary\u003e\n\u003cdiv\u003e\n\n## 7天用Go从零实现系列\n\n7天能写什么呢？类似 gin 的 web 框架？类似 groupcache 的分布式缓存？或者一个简单的 Python 解释器？希望这个仓库能给你答案。\n\n推荐先阅读 **[Go 语言简明教程](https://geektutu.com/post/quick-golang.html)**，一篇文章了解Go的基本语法、并发编程，依赖管理等内容。\n\n推荐 **[Go 语言笔试面试题](https://geektutu.com/post/qa-golang.html)**，加深对 Go 语言的理解。\n\n推荐 **[Go 语言高性能编程](https://geektutu.com/post/high-performance-go.html)**([项目地址](https://github.com/geektutu/high-performance-go))，写出高性能的 Go 代码。\n\n期待关注我的「[知乎专栏](https://zhuanlan.zhihu.com/geekgo)」和「[微博](http://weibo.com/geektutu)」，查看最近的文章和动态。\n\n### 7天用Go从零实现Web框架 - Gee\n\n[Gee](https://geektutu.com/post/gee.html) 是一个模仿 [gin](https://github.com/gin-gonic/gin) 实现的 Web 框架，[Go Gin简明教程](https://geektutu.com/post/quick-go-gin.html)可以快速入门。\n\n- 第一天：[前置知识(http.Handler接口)](https://geektutu.com/post/gee-day1.html) | [Code](gee-web/day1-http-base)\n- 第二天：[上下文设计(Context)](https://geektutu.com/post/gee-day2.html) | [Code](gee-web/day2-context)\n- 第三天：[Trie树路由(Router)](https://geektutu.com/post/gee-day3.html) | [Code](gee-web/day3-router)\n- 第四天：[分组控制(Group)](https://geektutu.com/post/gee-day4.html) | [Code](gee-web/day4-group)\n- 第五天：[中间件(Middleware)](https://geektutu.com/post/gee-day5.html) | [Code](gee-web/day5-middleware)\n- 第六天：[HTML模板(Template)](https://geektutu.com/post/gee-day6.html) | [Code](gee-web/day6-template)\n- 第七天：[错误恢复(Panic Recover)](https://geektutu.com/post/gee-day7.html) | [Code](gee-web/day7-panic-recover)\n\n### 7天用Go从零实现分布式缓存 GeeCache\n\n[GeeCache](https://geektutu.com/post/geecache.html) 是一个模仿 [groupcache](https://github.com/golang/groupcache) 实现的分布式缓存系统\n\n- 第一天：[LRU 缓存淘汰策略](https://geektutu.com/post/geecache-day1.html) | [Code](gee-cache/day1-lru)\n- 第二天：[单机并发缓存](https://geektutu.com/post/geecache-day2.html) | [Code](gee-cache/day2-single-node)\n- 第三天：[HTTP 服务端](https://geektutu.com/post/geecache-day3.html) | [Code](gee-cache/day3-http-server)\n- 第四天：[一致性哈希(Hash)](https://geektutu.com/post/geecache-day4.html) | [Code](gee-cache/day4-consistent-hash)\n- 第五天：[分布式节点](https://geektutu.com/post/geecache-day5.html) | [Code](gee-cache/day5-multi-nodes)\n- 第六天：[防止缓存击穿](https://geektutu.com/post/geecache-day6.html) | [Code](gee-cache/day6-single-flight)\n- 第七天：[使用 Protobuf 通信](https://geektutu.com/post/geecache-day7.html) | [Code](gee-cache/day7-proto-buf)\n\n### 7天用Go从零实现ORM框架 GeeORM\n\n[GeeORM](https://geektutu.com/post/geeorm.html) 是一个模仿 [gorm](https://github.com/jinzhu/gorm) 和 [xorm](https://github.com/go-xorm/xorm) 的 ORM 框架\n\ngorm 准备推出完全重写的 v2 版本(目前还在开发中)，相对 gorm-v1 来说，xorm 的设计更容易理解，所以 geeorm 接口设计上主要参考了 xorm，一些细节实现上参考了 gorm。\n\n- 第一天：[database/sql 基础](https://geektutu.com/post/geeorm-day1.html) | [Code](gee-orm/day1-database-sql)\n- 第二天：[对象表结构映射](https://geektutu.com/post/geeorm-day2.html) | [Code](gee-orm/day2-reflect-schema)\n- 第三天：[记录新增和查询](https://geektutu.com/post/geeorm-day3.html) | [Code](gee-orm/day3-save-query)\n- 第四天：[链式操作与更新删除](https://geektutu.com/post/geeorm-day4.html) | [Code](gee-orm/day4-chain-operation)\n- 第五天：[实现钩子(Hooks)](https://geektutu.com/post/geeorm-day5.html) | [Code](gee-orm/day5-hooks)\n- 第六天：[支持事务(Transaction)](https://geektutu.com/post/geeorm-day6.html) | [Code](gee-orm/day6-transaction)\n- 第七天：[数据库迁移(Migrate)](https://geektutu.com/post/geeorm-day7.html) | [Code](gee-orm/day7-migrate)\n\n\n### 7天用Go从零实现RPC框架 GeeRPC\n\n[GeeRPC](https://geektutu.com/post/geerpc.html) 是一个基于 [net/rpc](https://github.com/golang/go/tree/master/src/net/rpc) 开发的 RPC 框架\nGeeRPC 是基于 Go 语言标准库 `net/rpc` 实现的，添加了协议交换、服务注册与发现、负载均衡等功能，代码约 1k。\n\n- 第一天 - [服务端与消息编码](https://geektutu.com/post/geerpc-day1.html) | [Code](gee-rpc/day1-codec)\n- 第二天 - [支持并发与异步的客户端](https://geektutu.com/post/geerpc-day2.html) | [Code](gee-rpc/day2-client)\n- 第三天 - [服务注册(service register)](https://geektutu.com/post/geerpc-day3.html) | [Code](gee-rpc/day3-service )\n- 第四天 - [超时处理(timeout)](https://geektutu.com/post/geerpc-day4.html) | [Code](gee-rpc/day4-timeout )\n- 第五天 - [支持HTTP协议](https://geektutu.com/post/geerpc-day5.html) | [Code](gee-rpc/day5-http-debug)\n- 第六天 - [负载均衡(load balance)](https://geektutu.com/post/geerpc-day6.html) | [Code](gee-rpc/day6-load-balance)\n- 第七天 - [服务发现与注册中心(registry)](https://geektutu.com/post/geerpc-day7.html) | [Code](gee-rpc/day7-registry)\n\n### WebAssembly 使用示例\n\n具体的实践过程记录在 [Go WebAssembly 简明教程](https://geektutu.com/post/quick-go-wasm.html)。\n\n- 示例一：Hello World | [Code](demo-wasm/hello-world)\n- 示例二：注册函数 | [Code](demo-wasm/register-functions)\n- 示例三：操作 DOM | [Code](demo-wasm/manipulate-dom)\n- 示例四：回调函数 | [Code](demo-wasm/callback)\n\n\u003c/div\u003e\n\u003c/details\u003e\n\nWhat 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.\n\n## Web Framework - Gee\n\n[Gee](https://geektutu.com/post/gee.html) is a [gin](https://github.com/gin-gonic/gin)-like framework\n\n- Day 1 - http.Handler Interface Basic [Code](gee-web/day1-http-base)\n- Day 2 - Design a Flexiable Context [Code](gee-web/day2-context)\n- Day 3 - Router with Trie-Tree Algorithm [Code](gee-web/day3-router)\n- Day 4 - Group Control [Code](gee-web/day4-group)\n- Day 5 - Middleware Mechanism [Code](gee-web/day5-middleware)\n- Day 6 - Embeded Template Support [Code](gee-web/day6-template)\n- Day 7 - Panic Recover \u0026 Make it Robust [Code](gee-web/day7-panic-recover)\n\n## Distributed Cache - GeeCache\n\n[GeeCache](https://geektutu.com/post/geecache.html) is a [groupcache](https://github.com/golang/groupcache)-like distributed cache\n\n- Day 1 - LRU (Least Recently Used) Caching Strategy [Code](gee-cache/day1-lru)\n- Day 2 - Single Machine Concurrent Cache [Code](gee-cache/day2-single-node)\n- Day 3 - Launch a HTTP Server [Code](gee-cache/day3-http-server)\n- Day 4 - Consistent Hash Algorithm [Code](gee-cache/day4-consistent-hash)\n- Day 5 - Communication between Distributed Nodes [Code](gee-cache/day5-multi-nodes)\n- Day 6 - Cache Breakdown \u0026 Single Flight  | [Code](gee-cache/day6-single-flight)\n- Day 7 - Use Protobuf as RPC Data Exchange Type | [Code](gee-cache/day7-proto-buf)\n\n## Object Relational Mapping - GeeORM\n\n[GeeORM](https://geektutu.com/post/geeorm.html) is a [gorm](https://github.com/jinzhu/gorm)-like and [xorm](https://github.com/go-xorm/xorm)-like object relational mapping library\n\nXorm's desgin is easier to understand than gorm-v1, so the main designs references xorm and some detailed implementions references gorm-v1.\n\n- Day 1 - database/sql Basic | [Code](gee-orm/day1-database-sql)\n- Day 2 - Object Schame Mapping | [Code](gee-orm/day2-reflect-schema)\n- Day 3 - Insert and Query | [Code](gee-orm/day3-save-query)\n- Day 4 - Chain, Delete and Update | [Code](gee-orm/day4-chain-operation)\n- Day 5 - Support Hooks | [Code](gee-orm/day5-hooks)\n- Day 6 - Support Transaction | [Code](gee-orm/day6-transaction)\n- Day 7 - Migrate Database | [Code](gee-orm/day7-migrate)\n\n## RPC Framework - GeeRPC\n\n[GeeRPC](https://geektutu.com/post/geerpc.html) is a [net/rpc](https://github.com/golang/go/tree/master/src/net/rpc)-like RPC framework\n\nBased on golang standard library `net/rpc`, GeeRPC implements more features. eg, protocol exchange, service registration and discovery, load balance, etc.\n\n- Day 1 - Server Message Codec | [Code](gee-rpc/day1-codec)\n- Day 2 - Concurrent Client | [Code](gee-rpc/day2-client)\n- Day 3 - Service Register | [Code](gee-rpc/day3-service )\n- Day 4 - Timeout Processing | [Code](gee-rpc/day4-timeout )\n- Day 5 - Support HTTP Protocol | [Code](gee-rpc/day5-http-debug)\n- Day 6 - Load Balance | [Code](gee-rpc/day6-load-balance)\n- Day 7 - Discovery and Registry | [Code](gee-rpc/day7-registry)\n\n## Golang WebAssembly Demo\n\n- Demo 1 - Hello World [Code](demo-wasm/hello-world)\n- Demo 2 - Register Functions [Code](demo-wasm/register-functions)\n- Demo 3 - Manipulate DOM [Code](demo-wasm/manipulate-dom)\n- Demo 4 - Callback [Code](demo-wasm/callback)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeektutu%2F7days-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeektutu%2F7days-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeektutu%2F7days-golang/lists"}