Skip to content

Commit

Permalink
Merge pull request #4 from jupitergao18/develop
Browse files Browse the repository at this point in the history
add rayon support, add _exists _nexists, _page is optional now
  • Loading branch information
jupitergao18 authored Oct 9, 2023
2 parents 6913357 + b3b5402 commit 2f60119
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 57 deletions.
83 changes: 82 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "jserver"
authors = ["JupiterGao <tj.gaojie@outlook.com>"]
description = "A json api and static files server"
version = "0.1.3"
version = "0.1.4"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -14,6 +14,7 @@ clap = { version = "4", features = ["derive"] }
ctrlc = "3"
env_logger = "0.10"
log = "0.4"
rayon = "1.7.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,21 @@ For numbers, use the following suffix: `_lt`, `_lte`, `_gt`, `_gte` for `<`, `<=
For strings, use `_like` for `contains` and `_nlike` for `not contains`.
For arrays, use `_contains` for `contains` and `_ncontains` for `not contains`.
For numbers, strings, booleans, use `_ne` for `!=`.

For fields, use `_exists` for `is not null` and `_nexists` for `is null`.

```
GET /api/posts?title_like=server
GET /api/posts?id_gt=1&id_lt=3
GET /api/posts?id_gt=1&id_lt=3&title_exists=true
```

### Paginate

Use `_page` and optionally `_size` to paginate returned data.
Use optional `_page` and optional `_size` to paginate returned data.

```
GET /api/posts?_page=7
GET /api/posts?_page=7&_size=20
GET /api/posts?_size=100
```

_20 items are returned by default, page is 1 based(0 is treated as 1)_
Expand Down
7 changes: 4 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,21 @@ GET /api/posts?id=1
对于字符串,使用 `_like` 表示包含子字符串, `_nlike` 表示不包含子字符串。
对于数组,使用 `_contains` 表示包含元素, `_ncontains` 表示不包含元素。
对于数值、字符串和布尔值,使用 `_ne` 表示 `!=`

对于字段,使用 `_exists` 表示存在, `_nexists` 表示不存在。

```
GET /api/posts?title_like=server
GET /api/posts?id_gt=1&id_lt=3
GET /api/posts?id_gt=1&id_lt=3&title_exists=true
```

### 分页

使用 `_page` 和可选的 `_size` 对返回数据进行分页。
使用可选的 `_page` 和可选的 `_size` 对返回数据进行分页。

```
GET /api/posts?_page=7
GET /api/posts?_page=7&_size=20
GET /api/posts?_size=100
```

_默认每页返回 20 项,页号从 1 开始计数( 0 当做 1 处理)。_
Expand Down
Loading

0 comments on commit 2f60119

Please sign in to comment.