docs: readme
This commit is contained in:
parent
076ff04f0c
commit
4330051e9c
31
README.md
31
README.md
@ -8,3 +8,34 @@ mdbc: mongodb database connector
|
||||
|
||||
- [ ] 完成初始化程序
|
||||
- [ ] 封装CRUD
|
||||
|
||||
## usage
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"gitter.top/coco/mdbc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var driver = mdbc.NewMDBC(&mdbc.Config{
|
||||
Address: "192.168.3.21",
|
||||
Port: 0,
|
||||
Username: "admin",
|
||||
Password: "admin",
|
||||
ProcessTimeout: 0,
|
||||
ReadPref: 0,
|
||||
DbName: "articles",
|
||||
}).BindModel(&mdbc.ModelArticles{})
|
||||
|
||||
res, err := driver.Insert().SetContext(context.Background()).Insert(&mdbc.ModelArticles{
|
||||
Id: "hello---------",
|
||||
Title: "你好,世界",
|
||||
AvatarUrl: "",
|
||||
Phone: "",
|
||||
CreateTime: 0,
|
||||
UpdateTime: 0,
|
||||
})
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user