Skip to content
/ face Public

Generate http-api based on idl (like thrift)

Notifications You must be signed in to change notification settings

xiongwei9/face

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face 接口生成

face -i [inputFile] -o [outputDir]

TODO LIST

  • 类型校验
  • 支持多idl文件
  • 生成代码结构优化
  • 新增接口判断

生成目录结构

/facegen
    /namespace/dirname
        /service1.go
        /service2.go
    /utils.go # NewMethod函数

生成代码示例

结构体:

type UserInfoResponse struct {
	OpenId   string `json:"openId"`
	UserName string `json:"useName"`
	Email    string `json:"email"`
	Phone    string `json:"phone"`
}

type UserInfoRequest struct {
	OpenId string `form:"openId"`
}

接口:

func getUserInfo(r *gin.Context, params *UserInfoRequest) (*UserInfoResponse, error) {
	userInfo := &UserInfoResponse{}
	return userInfo, nil
}

func ServiceName_RouteGroup(r *gin.RouterGroup) {
	r.GET("/getUserInfo", NewMethod(getUserInfo))
}

About

Generate http-api based on idl (like thrift)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published