Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Jul 3, 2023
1 parent e78f1e7 commit c5abde4
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 20 deletions.
8 changes: 8 additions & 0 deletions docs/content.en/docs/recommends/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
weight: 2
bookFlatSection: true
title: "Recommends"
---

- [go-mir](https://alimy.me/mir) - 🔥a cool help tool to develop RESTful web service.
- [paopao-ce](https://github.com/rocboss/paopao-ce/tree/dev) - 🔥an artistic "twitter like" community built on gin+zinc+vue+ts.
8 changes: 8 additions & 0 deletions docs/content.en/docs/tutorials/projects-use-yesql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
weight: 11
title: "Projects Use Yesql"
---

### Projects Use Yesql
* [examples](https://github.com/alimy/yesql/tree/main/examples) - examples in this project.
* [paopao-ce](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-plus) - A artistic "twitter like" community built on gin+zinc+vue+ts.
19 changes: 9 additions & 10 deletions docs/content.en/docs/tutorials/quick-start.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
weight: 10
title: "Quick Start"
---

[![Go](https://github.com/alimy/yesql/actions/workflows/go.yml/badge.svg)](https://github.com/alimy/yesql/actions/workflows/go.yml)
[![GoDoc](https://godoc.org/github.com/alimy/yesql?status.svg)](https://pkg.go.dev/github.com/alimy/yesql)
[![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?logo=sourcegraph)](https://sourcegraph.com/github.com/alimy/yesql)
Expand All @@ -12,9 +17,7 @@ Yesql parses a file and associate SQL queries to a map. Useful for separating SQ
$ go get github.com/alimy/yesql
```

### Usage

#### Create a file containing your SQL queries
### Create a file containing your SQL queries

```sql
-- sql file yesql.sql
Expand Down Expand Up @@ -75,7 +78,7 @@ SELECT id, user_id, tag, quote_num FROM @tag WHERE tag IN (?);
UPDATE @tag SET quote_num=quote_num+1, is_del=0, modified_on=? WHERE id IN (?);
```

#### Use scanning mode
### Use scanning mode
```go
// file: topics.go

Expand Down Expand Up @@ -120,7 +123,7 @@ func NewTopic(db *sqlx.DB) (*Topic, error) {
}
```

#### Use code generate mode
### Use code generate mode

* Create code generate logic
```go
Expand Down Expand Up @@ -229,8 +232,4 @@ func BuildTopic(p yesql.PreparexBuilder, ctx ...context.Context) (obj *Topic, er
}
return
}
```

### Projects that used Yesql
* [examples](examples) - examples in this project.
* [paopao-ce](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-plus) - A artistic "twitter like" community built on gin+zinc+vue+ts.
```
8 changes: 8 additions & 0 deletions docs/content.zh/docs/recommends/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
weight: 2
bookFlatSection: true
title: "推荐项目"
---

- [go-mir](https://alimy.me/mir) - 🔥一个很酷的开发RESTful API的辅助工具.
- [paopao-ce](https://github.com/rocboss/paopao-ce/tree/dev) - 🔥一个清新文艺的微社区.
File renamed without changes.
8 changes: 8 additions & 0 deletions docs/content.zh/docs/tutorials/projects-use-yesql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
weight: 11
title: "使用Yesql的项目"
---

### 使用Yesql的项目
* [examples](https://github.com/alimy/yesql/tree/main/examples) - examples in this project.
* [paopao-ce](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-plus) - A artistic "twitter like" community built on gin+zinc+vue+ts.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
weight: 10
title: "快速开始"
---

[![Go](https://github.com/alimy/yesql/actions/workflows/go.yml/badge.svg)](https://github.com/alimy/yesql/actions/workflows/go.yml)
[![GoDoc](https://godoc.org/github.com/alimy/yesql?status.svg)](https://pkg.go.dev/github.com/alimy/yesql)
[![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?logo=sourcegraph)](https://sourcegraph.com/github.com/alimy/yesql)
Expand All @@ -12,9 +17,7 @@ Yesql解析一个SQL文件,提取出查询语句,自动生成对应的Go结
$ go get github.com/alimy/yesql
```

### 使用

#### 创建sql文件
### 创建sql文件

```sql
-- sql file yesql.sql
Expand Down Expand Up @@ -75,7 +78,7 @@ SELECT id, user_id, tag, quote_num FROM @tag WHERE tag IN (?);
UPDATE @tag SET quote_num=quote_num+1, is_del=0, modified_on=? WHERE id IN (?);
```

#### 使用Scan模式(方式一)
### 使用Scan模式(方式一)
```go
// file: topics.go

Expand Down Expand Up @@ -120,7 +123,7 @@ func NewTopic(db *sqlx.DB) (*Topic, error) {
}
```

#### 使用代码生成模式(方式二)
### 使用代码生成模式(方式二)
* 编写代码生成逻辑
```go
// file: gen.go
Expand Down Expand Up @@ -229,8 +232,3 @@ func BuildTopic(p yesql.PreparexBuilder, ctx ...context.Context) (obj *Topic, er
return
}
```

### 使用Yesql的项目
* [examples](examples) - 项目自带的Demo
* [paopao-ce](https://github.com/rocboss/paopao-ce/tree/r/paopao-ce-plus) - 一个清新文艺的微社区

0 comments on commit c5abde4

Please sign in to comment.