-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: 动手写ORM框架 - GeeORM第一天 database/sql 基础 | ||
date: 2020-03-03 23:00:00 | ||
description: 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。介绍了 SQLite 的基础操作(连接数据库,创建表、增删记录等),使用 Go 标准库 database/sql 操作 SQLite 数据库,包括执行(Exec),查询(Query, QueryRow)。 | ||
tags: | ||
- Go | ||
nav: 从零实现 | ||
categories: | ||
- ORM框架 - GeeORM | ||
keywords: | ||
- Go语言 | ||
- 从零实现ORM框架 | ||
- database/sql | ||
- sqlite | ||
image: post/geeorm/geeorm_sm.jpg | ||
github: https://github.com/geektutu/7days-golang | ||
published: false | ||
--- | ||
|
||
本文是[7天用Go从零实现ORM框架GeeORM](https://geektutu.com/post/geeorm.html)的第一篇。 | ||
|
||
- SQLite 的基础操作(连接数据库,创建表、增删记录等)。 | ||
- 使用 Go 语言标准库 database/sql 连接并操作 SQLite 数据库,并简单封装。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: 动手写ORM框架 - GeeORM第二天 对象表结构映射 | ||
date: 2020-03-03 23:00:00 | ||
description: 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。使用反射(reflect)获取任意 struct 对象的名称和字段,映射为数据中的表;使用 dialect 隔离不同数据库之间的差异,便于扩展;数据表的创建(create)、删除(drop)。 | ||
tags: | ||
- Go | ||
nav: 从零实现 | ||
categories: | ||
- ORM框架 - GeeORM | ||
keywords: | ||
- Go语言 | ||
- 从零实现ORM框架 | ||
- database/sql | ||
- sqlite | ||
- reflect | ||
- table mapping | ||
image: post/geeorm/geeorm_sm.jpg | ||
github: https://github.com/geektutu/7days-golang | ||
published: false | ||
--- | ||
|
||
本文是[7天用Go从零实现ORM框架GeeORM](https://geektutu.com/post/geeorm.html)的第二篇。 | ||
|
||
- 使用反射(reflect)获取任意 struct 对象的名称和字段,映射为数据中的表。 | ||
- 使用 dialect 隔离不同数据库之间的差异,便于扩展。 | ||
- 数据表的创建(create)、删除(drop)。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: 动手写ORM框架 - GeeORM第三天 插入和查询记录 | ||
date: 2020-03-03 23:00:00 | ||
description: 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。实现新增(insert)记录的功能;使用反射(reflect)将数据库的记录转换为对应的结构体,实现查询(select)功能。 | ||
tags: | ||
- Go | ||
nav: 从零实现 | ||
categories: | ||
- ORM框架 - GeeORM | ||
keywords: | ||
- Go语言 | ||
- 从零实现ORM框架 | ||
- database/sql | ||
- sqlite | ||
- insert into | ||
- select from | ||
image: post/geeorm/geeorm_sm.jpg | ||
github: https://github.com/geektutu/7days-golang | ||
published: false | ||
--- | ||
|
||
本文是[7天用Go从零实现ORM框架GeeORM](https://geektutu.com/post/geeorm.html)的第三篇。 | ||
|
||
- 实现新增(insert)记录的功能。 | ||
- 使用反射(reflect)将数据库的记录转换为对应的结构体,实现查询(select)功能。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: 动手写ORM框架 - GeeORM第四天 链式操作与更新删除 | ||
date: 2020-03-03 23:00:00 | ||
description: 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。通过链式(chain)操作,支持查询条件(where, order by, limit 等)的叠加;实现记录的更新(update)和删除(delete)功能。 | ||
tags: | ||
- Go | ||
nav: 从零实现 | ||
categories: | ||
- ORM框架 - GeeORM | ||
keywords: | ||
- Go语言 | ||
- 从零实现ORM框架 | ||
- database/sql | ||
- sqlite | ||
- chain operation | ||
- delete from | ||
image: post/geeorm/geeorm_sm.jpg | ||
github: https://github.com/geektutu/7days-golang | ||
published: false | ||
--- | ||
|
||
本文是[7天用Go从零实现ORM框架GeeORM](https://geektutu.com/post/geeorm.html)的第四篇。 | ||
|
||
- 通过链式(chain)操作,支持查询条件(where, order by, limit 等)的叠加。 | ||
- 实现记录的更新(update)和删除(delete)功能。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: 动手写ORM框架 - GeeORM第五天 实现钩子(Hooks) | ||
date: 2020-03-03 23:00:00 | ||
description: 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。通过反射(reflect)获取结构体绑定的钩子(hooks),并调用;支持增删查改(CRUD)前后调用钩子。 | ||
tags: | ||
- Go | ||
nav: 从零实现 | ||
categories: | ||
- ORM框架 - GeeORM | ||
keywords: | ||
- Go语言 | ||
- 从零实现ORM框架 | ||
- database/sql | ||
- sqlite | ||
- hooks | ||
- BeforeUpdate | ||
image: post/geeorm/geeorm_sm.jpg | ||
github: https://github.com/geektutu/7days-golang | ||
published: false | ||
--- | ||
|
||
本文是[7天用Go从零实现ORM框架GeeORM](https://geektutu.com/post/geeorm.html)的第五篇。 | ||
|
||
- 通过反射(reflect)获取结构体绑定的钩子(hooks),并调用。 | ||
- 支持增删查改(CRUD)前后调用钩子。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: 动手写ORM框架 - GeeORM第六天 支持事务(Transaction) | ||
date: 2020-03-03 23:00:00 | ||
description: 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。介绍 SQLite 数据库中的事务(transaction);封装事务,用户自定义回调函数实现原子操作。 | ||
tags: | ||
- Go | ||
nav: 从零实现 | ||
categories: | ||
- ORM框架 - GeeORM | ||
keywords: | ||
- Go语言 | ||
- 从零实现ORM框架 | ||
- database/sql | ||
- sqlite | ||
- transaction | ||
image: post/geeorm/geeorm_sm.jpg | ||
github: https://github.com/geektutu/7days-golang | ||
published: false | ||
--- | ||
|
||
本文是[7天用Go从零实现ORM框架GeeORM](https://geektutu.com/post/geeorm.html)的第六篇。 | ||
|
||
- 介绍 SQLite 数据库中的事务(transaction)。 | ||
- 封装事务,用户自定义回调函数实现原子操作。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: 动手写ORM框架 - GeeORM第七天 数据库迁移(Migrate) | ||
date: 2020-03-03 23:00:00 | ||
description: 7天用 Go语言/golang 从零实现 ORM 框架 GeeORM 教程(7 days implement golang object relational mapping framework from scratch tutorial),动手写 ORM 框架,参照 gorm, xorm 的实现。结构体(struct)变更时,数据库表的字段(field)自动迁移(migrate);仅支持字段新增与删除,不支持字段类型变更。 | ||
tags: | ||
- Go | ||
nav: 从零实现 | ||
categories: | ||
- ORM框架 - GeeORM | ||
keywords: | ||
- Go语言 | ||
- 从零实现ORM框架 | ||
- database/sql | ||
- sqlite | ||
- migrate | ||
image: post/geeorm/geeorm_sm.jpg | ||
github: https://github.com/geektutu/7days-golang | ||
published: false | ||
--- | ||
|
||
本文是[7天用Go从零实现ORM框架GeeORM](https://geektutu.com/post/geeorm.html)的第七篇。 | ||
|
||
- 结构体(struct)变更时,数据库表的字段(field)自动迁移(migrate)。 | ||
- 仅支持字段新增与删除,不支持字段类型变更。 |