Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloured-glaze committed Jan 6, 2023
1 parent a2d8f91 commit 57de5f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ The package is now imported under the "cmap" namespace.

```

```go

// Create a new map.
m := cmap.New[map[string]int]()

// Sets item within map, sets "bar" under key "foo"
m.Set("user", make(map[string]int))

// Retrieve item from map.
bar, ok := m.Get("user")

// Removes item under key "foo"
m.Remove("user")

```

For more examples have a look at concurrent_map_test.go.

Running tests:
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ go get "github.com/Coloured-glaze/cmap"
m := cmap.New[map[string]int]()

// 设置变量m一个键为 "user" 值为 map[string]int 键值对
m.Set("user", map[string]int)
m.Set("user", make(map[string]int))

// 从m中获取指定键值.
v, ok := m.Get("user")
Expand All @@ -70,5 +70,9 @@ go test "github.com/Coloured-glaze/cmap"
- 如果代码是关于性能问题的,则必须在流程中包括基准测试(无论是在问题中还是在PR中)。
- 一般来说,我们希望`concurrent-map`尽可能简单,且与原生的`map`有相似的操作。当你新建issue时请注意这一点。

## language
- [中文说明](./README.md)
- [English description](./README-en.md)

## 许可证
MIT (see [LICENSE](https://github.com/Coloured-glaze/cmap/blob/master/LICENSE) file)

0 comments on commit 57de5f8

Please sign in to comment.