Skip to content

Commit

Permalink
生成文档
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomeng79 committed Sep 4, 2019
1 parent 9e152cf commit d486c00
Show file tree
Hide file tree
Showing 4 changed files with 286 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ release :
next-version :
@chmod +x ./scripts/version.sh && ./scripts/version.sh

#使用godoc生成markdown文档
gendoc :
godoc2ghmd `pwd`/srv/account/ > `pwd`/docs/godoc2md/account.md
godoc2ghmd `pwd`/srv/user/ > `pwd`/docs/godoc2md/user.md

#清理没用的docker镜像
docker-clean:
docker images
Expand Down
104 changes: 104 additions & 0 deletions docs/godoc2md/account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# account
`import "/home/meng/workspace/go/istio-micro/srv/account/"`

* [Overview](#pkg-overview)
* [Imported Packages](#pkg-imports)
* [Index](#pkg-index)

## <a name="pkg-overview">Overview</a>

## <a name="pkg-imports">Imported Packages</a>

- github.com/asaskevich/govalidator
- github.com/golang/protobuf/ptypes/empty
- github.com/grpc-ecosystem/go-grpc-middleware
- github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing
- github.com/xiaomeng79/go-log
- github.com/xiaomeng79/istio-micro/cinit
- github.com/xiaomeng79/istio-micro/internal/gateway
- github.com/xiaomeng79/istio-micro/internal/sqlupdate
- github.com/xiaomeng79/istio-micro/internal/utils
- github.com/xiaomeng79/istio-micro/internal/wrapper
- github.com/xiaomeng79/istio-micro/srv/account/proto
- github.com/xiaomeng79/istio-micro/version
- google.golang.org/grpc
- google.golang.org/grpc/codes
- google.golang.org/grpc/reflection
- google.golang.org/grpc/status

## <a name="pkg-index">Index</a>
* [Constants](#pkg-constants)
* [func Run()](#Run)
* [type Account](#Account)
* [func (m \*Account) Add(ctx context.Context) error](#Account.Add)
* [func (m \*Account) QueryOne(ctx context.Context) error](#Account.QueryOne)
* [func (m \*Account) Update(ctx context.Context) error](#Account.Update)
* [type AccountServer](#AccountServer)
* [func (s \*AccountServer) AccountAdd(ctx context.Context, in \*pb.AccountBase) (out \*pb.AccountBase, outerr error)](#AccountServer.AccountAdd)
* [func (s \*AccountServer) AccountQueryOne(ctx context.Context, in \*pb.AccountId) (out \*pb.AccountBase, outerr error)](#AccountServer.AccountQueryOne)
* [func (s \*AccountServer) AccountUpdate(ctx context.Context, in \*pb.AccountUpdateReq) (out \*empty.Empty, outerr error)](#AccountServer.AccountUpdate)

#### <a name="pkg-files">Package files</a>
[account.go](./account.go) [model.go](./model.go) [run.go](./run.go) [versionupdate.go](./versionupdate.go)

## <a name="pkg-constants">Constants</a>
``` go
const (
SN = "srv-account" //定义services名称
)
```

## <a name="Run">func</a> [Run](./run.go#L21)
``` go
func Run()
```

## <a name="Account">type</a> [Account](./model.go#L14-L17)
``` go
type Account struct {
Page utils.Page
// contains filtered or unexported fields
}
```

### <a name="Account.Add">func</a> (\*Account) [Add](./model.go#L62)
``` go
func (m *Account) Add(ctx context.Context) error
```
添加 ,返回id

### <a name="Account.QueryOne">func</a> (\*Account) [QueryOne](./model.go#L129)
``` go
func (m *Account) QueryOne(ctx context.Context) error
```
查询一个

### <a name="Account.Update">func</a> (\*Account) [Update](./model.go#L92)
``` go
func (m *Account) Update(ctx context.Context) error
```
修改

## <a name="AccountServer">type</a> [AccountServer](./account.go#L11)
``` go
type AccountServer struct{}
```

### <a name="AccountServer.AccountAdd">func</a> (\*AccountServer) [AccountAdd](./account.go#L13)
``` go
func (s *AccountServer) AccountAdd(ctx context.Context, in *pb.AccountBase) (out *pb.AccountBase, outerr error)
```

### <a name="AccountServer.AccountQueryOne">func</a> (\*AccountServer) [AccountQueryOne](./account.go#L65)
``` go
func (s *AccountServer) AccountQueryOne(ctx context.Context, in *pb.AccountId) (out *pb.AccountBase, outerr error)
```
查询一个

### <a name="AccountServer.AccountUpdate">func</a> (\*AccountServer) [AccountUpdate](./account.go#L26)
``` go
func (s *AccountServer) AccountUpdate(ctx context.Context, in *pb.AccountUpdateReq) (out *empty.Empty, outerr error)
```

- - -
Generated by [godoc2ghmd](https://github.com/GandalfUK/godoc2ghmd)
171 changes: 171 additions & 0 deletions docs/godoc2md/user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# user
`import "/home/meng/workspace/go/istio-micro/srv/user/"`

* [Overview](#pkg-overview)
* [Imported Packages](#pkg-imports)
* [Index](#pkg-index)

## <a name="pkg-overview">Overview</a>

## <a name="pkg-imports">Imported Packages</a>

- github.com/Shopify/sarama
- github.com/asaskevich/govalidator
- github.com/grpc-ecosystem/go-grpc-middleware
- github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing
- github.com/jinzhu/copier
- github.com/xiaomeng79/go-log
- github.com/xiaomeng79/istio-micro/cinit
- github.com/xiaomeng79/istio-micro/internal/gateway
- github.com/xiaomeng79/istio-micro/internal/utils
- github.com/xiaomeng79/istio-micro/internal/wrapper
- github.com/xiaomeng79/istio-micro/srv/user/proto
- google.golang.org/grpc
- google.golang.org/grpc/codes
- google.golang.org/grpc/reflection
- google.golang.org/grpc/status

## <a name="pkg-index">Index</a>
* [Constants](#pkg-constants)
* [func Run()](#Run)
* [func UserCacheDel(ctx context.Context, id int64)](#UserCacheDel)
* [func UserCacheGet(ctx context.Context, id int64) (map[string]string, error)](#UserCacheGet)
* [func UserCacheSet(ctx context.Context, id int64)](#UserCacheSet)
* [type User](#User)
* [func (m \*User) Add(ctx context.Context) error](#User.Add)
* [func (m \*User) Delete(ctx context.Context) error](#User.Delete)
* [func (m \*User) QueryAll(ctx context.Context) ([]\*User, utils.Page, error)](#User.QueryAll)
* [func (m \*User) QueryOne(ctx context.Context) error](#User.QueryOne)
* [func (m \*User) Update(ctx context.Context) error](#User.Update)
* [type UserServer](#UserServer)
* [func (s \*UserServer) UserAdd(ctx context.Context, in \*pb.UserBase) (out \*pb.UserBase, outerr error)](#UserServer.UserAdd)
* [func (s \*UserServer) UserDelete(ctx context.Context, in \*pb.UserId) (out \*pb.UserId, outerr error)](#UserServer.UserDelete)
* [func (s \*UserServer) UserQueryAll(ctx context.Context, in \*pb.UserAllOption) (\*pb.UserAll, error)](#UserServer.UserQueryAll)
* [func (s \*UserServer) UserQueryOne(ctx context.Context, in \*pb.UserId) (out \*pb.UserBase, outerr error)](#UserServer.UserQueryOne)
* [func (s \*UserServer) UserUpdate(ctx context.Context, in \*pb.UserBase) (out \*pb.UserBase, outerr error)](#UserServer.UserUpdate)

#### <a name="pkg-files">Package files</a>
[cache.go](./cache.go) [common_cache.go](./common_cache.go) [model.go](./model.go) [msg_queue.go](./msg_queue.go) [run.go](./run.go) [user.go](./user.go)

## <a name="pkg-constants">Constants</a>
``` go
const (
KeyMaxExpire = 500 //
AgainGetStopTime = 100 * time.Millisecond
)
```
``` go
const (
SexMan = 1
SexWoman = 2
SexOther = 3
)
```
性别

``` go
const (
SN = "srv-user" //定义services名称
)
```
``` go
const (
UserCacheIdPrefix = "ucid"
)
```

## <a name="Run">func</a> [Run](./run.go#L21)
``` go
func Run()
```

## <a name="UserCacheDel">func</a> [UserCacheDel](./cache.go#L61)
``` go
func UserCacheDel(ctx context.Context, id int64)
```

## <a name="UserCacheGet">func</a> [UserCacheGet](./cache.go#L16)
``` go
func UserCacheGet(ctx context.Context, id int64) (map[string]string, error)
```

## <a name="UserCacheSet">func</a> [UserCacheSet](./cache.go#L42)
``` go
func UserCacheSet(ctx context.Context, id int64)
```

## <a name="User">type</a> [User](./model.go#L13-L21)
``` go
type User struct {
Id int64 `json:"id" db:"id" valid:"int~用户id类型为int"`
UserName string `json:"user_name" db:"user_name" valid:"required~用户名称必须存在"`
Password string `json:"password" db:"password" valid:"required~密码必须存在"`
Iphone string `json:"iphone" db:"iphone" valid:"required~手机号码必须存在"`
Sex int32 `json:"sex" db:"sex" valid:"required~性别必须存在"`
IsUsable int32 `json:"-" db:"is_usable"`
Page utils.Page
}
```

### <a name="User.Add">func</a> (\*User) [Add](./model.go#L127)
``` go
func (m *User) Add(ctx context.Context) error
```
添加

### <a name="User.Delete">func</a> (\*User) [Delete](./model.go#L163)
``` go
func (m *User) Delete(ctx context.Context) error
```
删除

### <a name="User.QueryAll">func</a> (\*User) [QueryAll](./model.go#L201)
``` go
func (m *User) QueryAll(ctx context.Context) ([]*User, utils.Page, error)
```
查询全部

### <a name="User.QueryOne">func</a> (\*User) [QueryOne](./model.go#L180)
``` go
func (m *User) QueryOne(ctx context.Context) error
```
查询一个

### <a name="User.Update">func</a> (\*User) [Update](./model.go#L145)
``` go
func (m *User) Update(ctx context.Context) error
```
修改

## <a name="UserServer">type</a> [UserServer](./user.go#L12)
``` go
type UserServer struct{}
```

### <a name="UserServer.UserAdd">func</a> (\*UserServer) [UserAdd](./user.go#L14)
``` go
func (s *UserServer) UserAdd(ctx context.Context, in *pb.UserBase) (out *pb.UserBase, outerr error)
```

### <a name="UserServer.UserDelete">func</a> (\*UserServer) [UserDelete](./user.go#L60)
``` go
func (s *UserServer) UserDelete(ctx context.Context, in *pb.UserId) (out *pb.UserId, outerr error)
```

### <a name="UserServer.UserQueryAll">func</a> (\*UserServer) [UserQueryAll](./user.go#L106)
``` go
func (s *UserServer) UserQueryAll(ctx context.Context, in *pb.UserAllOption) (*pb.UserAll, error)
```

### <a name="UserServer.UserQueryOne">func</a> (\*UserServer) [UserQueryOne](./user.go#L83)
``` go
func (s *UserServer) UserQueryOne(ctx context.Context, in *pb.UserId) (out *pb.UserBase, outerr error)
```

### <a name="UserServer.UserUpdate">func</a> (\*UserServer) [UserUpdate](./user.go#L37)
``` go
func (s *UserServer) UserUpdate(ctx context.Context, in *pb.UserBase) (out *pb.UserBase, outerr error)
```

- - -
Generated by [godoc2ghmd](https://github.com/GandalfUK/godoc2ghmd)
7 changes: 6 additions & 1 deletion srv/account/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ func (m *Account) Update(ctx context.Context) error {
// return nil
//}
//
//查询一个


// 查询一个
func (m *Account) QueryOne(ctx context.Context) error {
err := utils.V(m.validateId)
if err != nil {
Expand Down Expand Up @@ -193,3 +195,6 @@ func (m *Account) QueryOne(ctx context.Context) error {
// }
// return all, m.Page, err
//}



0 comments on commit d486c00

Please sign in to comment.