用户接口远程调用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

478 lines
12 KiB

// Code generated by protoc-gen-go.
// source: user.proto
// DO NOT EDIT!
/*
Package user is a generated protocol buffer package.
It is generated from these files:
user.proto
It has these top-level messages:
UserRequest
UserInfoByUsername
UserInfoByUsercode
UserResponse
LoginRequest
LoginResponse
*/
package user
import proto "github.com/chai2010/protorpc/proto"
import math "math"
import "io"
import "log"
import "net"
import "net/rpc"
import "time"
import protorpc "github.com/chai2010/protorpc"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = math.Inf
// 使用token查询用户信息请求结构
type UserRequest struct {
Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
Token *string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserRequest) Reset() { *m = UserRequest{} }
func (m *UserRequest) String() string { return proto.CompactTextString(m) }
func (*UserRequest) ProtoMessage() {}
func (m *UserRequest) GetDbname() string {
if m != nil && m.Dbname != nil {
return *m.Dbname
}
return ""
}
func (m *UserRequest) GetToken() string {
if m != nil && m.Token != nil {
return *m.Token
}
return ""
}
// 使用username查询用户信息请求结构
type UserInfoByUsername struct {
Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserInfoByUsername) Reset() { *m = UserInfoByUsername{} }
func (m *UserInfoByUsername) String() string { return proto.CompactTextString(m) }
func (*UserInfoByUsername) ProtoMessage() {}
func (m *UserInfoByUsername) GetDbname() string {
if m != nil && m.Dbname != nil {
return *m.Dbname
}
return ""
}
func (m *UserInfoByUsername) GetUsername() string {
if m != nil && m.Username != nil {
return *m.Username
}
return ""
}
// 使用usercode查询用户信息请求结构
type UserInfoByUsercode struct {
Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
Usercode *string `protobuf:"bytes,2,opt,name=usercode" json:"usercode,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserInfoByUsercode) Reset() { *m = UserInfoByUsercode{} }
func (m *UserInfoByUsercode) String() string { return proto.CompactTextString(m) }
func (*UserInfoByUsercode) ProtoMessage() {}
func (m *UserInfoByUsercode) GetDbname() string {
if m != nil && m.Dbname != nil {
return *m.Dbname
}
return ""
}
func (m *UserInfoByUsercode) GetUsercode() string {
if m != nil && m.Usercode != nil {
return *m.Usercode
}
return ""
}
// 使用token查询用户信息响应结构
type UserResponse struct {
UserId *string `protobuf:"bytes,1,opt,name=user_id" json:"user_id,omitempty"`
Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"`
Mobile *string `protobuf:"bytes,4,opt,name=mobile" json:"mobile,omitempty"`
Email *string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"`
Status *string `protobuf:"bytes,6,opt,name=status" json:"status,omitempty"`
BusinessId *string `protobuf:"bytes,7,opt,name=business_id" json:"business_id,omitempty"`
StoreId *string `protobuf:"bytes,8,opt,name=store_id" json:"store_id,omitempty"`
FansTo *string `protobuf:"bytes,9,opt,name=fans_to" json:"fans_to,omitempty"`
IsVip *string `protobuf:"bytes,10,opt,name=is_vip" json:"is_vip,omitempty"`
Usercode *string `protobuf:"bytes,11,opt,name=usercode" json:"usercode,omitempty"`
GroupId *string `protobuf:"bytes,12,opt,name=group_id" json:"group_id,omitempty"`
Type *string `protobuf:"bytes,13,opt,name=type" json:"type,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserResponse) Reset() { *m = UserResponse{} }
func (m *UserResponse) String() string { return proto.CompactTextString(m) }
func (*UserResponse) ProtoMessage() {}
func (m *UserResponse) GetUserId() string {
if m != nil && m.UserId != nil {
return *m.UserId
}
return ""
}
func (m *UserResponse) GetUsername() string {
if m != nil && m.Username != nil {
return *m.Username
}
return ""
}
func (m *UserResponse) GetNickname() string {
if m != nil && m.Nickname != nil {
return *m.Nickname
}
return ""
}
func (m *UserResponse) GetMobile() string {
if m != nil && m.Mobile != nil {
return *m.Mobile
}
return ""
}
func (m *UserResponse) GetEmail() string {
if m != nil && m.Email != nil {
return *m.Email
}
return ""
}
func (m *UserResponse) GetStatus() string {
if m != nil && m.Status != nil {
return *m.Status
}
return ""
}
func (m *UserResponse) GetBusinessId() string {
if m != nil && m.BusinessId != nil {
return *m.BusinessId
}
return ""
}
func (m *UserResponse) GetStoreId() string {
if m != nil && m.StoreId != nil {
return *m.StoreId
}
return ""
}
func (m *UserResponse) GetFansTo() string {
if m != nil && m.FansTo != nil {
return *m.FansTo
}
return ""
}
func (m *UserResponse) GetIsVip() string {
if m != nil && m.IsVip != nil {
return *m.IsVip
}
return ""
}
func (m *UserResponse) GetUsercode() string {
if m != nil && m.Usercode != nil {
return *m.Usercode
}
return ""
}
func (m *UserResponse) GetGroupId() string {
if m != nil && m.GroupId != nil {
return *m.GroupId
}
return ""
}
func (m *UserResponse) GetType() string {
if m != nil && m.Type != nil {
return *m.Type
}
return ""
}
// 用户登录请求结构
type LoginRequest struct {
Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
Account *string `protobuf:"bytes,2,opt,name=account" json:"account,omitempty"`
Password *string `protobuf:"bytes,3,opt,name=password" json:"password,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LoginRequest) Reset() { *m = LoginRequest{} }
func (m *LoginRequest) String() string { return proto.CompactTextString(m) }
func (*LoginRequest) ProtoMessage() {}
func (m *LoginRequest) GetDbname() string {
if m != nil && m.Dbname != nil {
return *m.Dbname
}
return ""
}
func (m *LoginRequest) GetAccount() string {
if m != nil && m.Account != nil {
return *m.Account
}
return ""
}
func (m *LoginRequest) GetPassword() string {
if m != nil && m.Password != nil {
return *m.Password
}
return ""
}
// 使用token查询用户信息响应结构
type LoginResponse struct {
UserId *string `protobuf:"bytes,1,opt,name=user_id" json:"user_id,omitempty"`
Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"`
Mobile *string `protobuf:"bytes,4,opt,name=mobile" json:"mobile,omitempty"`
Email *string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"`
Status *string `protobuf:"bytes,6,opt,name=status" json:"status,omitempty"`
BusinessId *string `protobuf:"bytes,7,opt,name=business_id" json:"business_id,omitempty"`
StoreId *string `protobuf:"bytes,8,opt,name=store_id" json:"store_id,omitempty"`
FansTo *string `protobuf:"bytes,9,opt,name=fans_to" json:"fans_to,omitempty"`
IsVip *string `protobuf:"bytes,10,opt,name=is_vip" json:"is_vip,omitempty"`
Token *string `protobuf:"bytes,11,opt,name=token" json:"token,omitempty"`
Usercode *string `protobuf:"bytes,12,opt,name=usercode" json:"usercode,omitempty"`
GroupId *string `protobuf:"bytes,13,opt,name=group_id" json:"group_id,omitempty"`
Type *string `protobuf:"bytes,14,opt,name=type" json:"type,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *LoginResponse) Reset() { *m = LoginResponse{} }
func (m *LoginResponse) String() string { return proto.CompactTextString(m) }
func (*LoginResponse) ProtoMessage() {}
func (m *LoginResponse) GetUserId() string {
if m != nil && m.UserId != nil {
return *m.UserId
}
return ""
}
func (m *LoginResponse) GetUsername() string {
if m != nil && m.Username != nil {
return *m.Username
}
return ""
}
func (m *LoginResponse) GetNickname() string {
if m != nil && m.Nickname != nil {
return *m.Nickname
}
return ""
}
func (m *LoginResponse) GetMobile() string {
if m != nil && m.Mobile != nil {
return *m.Mobile
}
return ""
}
func (m *LoginResponse) GetEmail() string {
if m != nil && m.Email != nil {
return *m.Email
}
return ""
}
func (m *LoginResponse) GetStatus() string {
if m != nil && m.Status != nil {
return *m.Status
}
return ""
}
func (m *LoginResponse) GetBusinessId() string {
if m != nil && m.BusinessId != nil {
return *m.BusinessId
}
return ""
}
func (m *LoginResponse) GetStoreId() string {
if m != nil && m.StoreId != nil {
return *m.StoreId
}
return ""
}
func (m *LoginResponse) GetFansTo() string {
if m != nil && m.FansTo != nil {
return *m.FansTo
}
return ""
}
func (m *LoginResponse) GetIsVip() string {
if m != nil && m.IsVip != nil {
return *m.IsVip
}
return ""
}
func (m *LoginResponse) GetToken() string {
if m != nil && m.Token != nil {
return *m.Token
}
return ""
}
func (m *LoginResponse) GetUsercode() string {
if m != nil && m.Usercode != nil {
return *m.Usercode
}
return ""
}
func (m *LoginResponse) GetGroupId() string {
if m != nil && m.GroupId != nil {
return *m.GroupId
}
return ""
}
func (m *LoginResponse) GetType() string {
if m != nil && m.Type != nil {
return *m.Type
}
return ""
}
func init() {
}
type UserService interface {
GetByToken(in *UserRequest, out *UserResponse) error
Login(in *LoginRequest, out *LoginResponse) error
}
// AcceptUserServiceClient accepts connections on the listener and serves requests
// for each incoming connection. Accept blocks; the caller typically
// invokes it in a go statement.
func AcceptUserServiceClient(lis net.Listener, x UserService) {
srv := rpc.NewServer()
if err := srv.RegisterName("UserService", x); err != nil {
log.Fatal(err)
}
for {
conn, err := lis.Accept()
if err != nil {
log.Fatalf("lis.Accept(): %v\n", err)
}
go srv.ServeCodec(protorpc.NewServerCodec(conn))
}
}
// RegisterUserService publish the given UserService implementation on the server.
func RegisterUserService(srv *rpc.Server, x UserService) error {
if err := srv.RegisterName("UserService", x); err != nil {
return err
}
return nil
}
// NewUserServiceServer returns a new UserService Server.
func NewUserServiceServer(x UserService) *rpc.Server {
srv := rpc.NewServer()
if err := srv.RegisterName("UserService", x); err != nil {
log.Fatal(err)
}
return srv
}
// ListenAndServeUserService listen announces on the local network address laddr
// and serves the given UserService implementation.
func ListenAndServeUserService(network, addr string, x UserService) error {
lis, err := net.Listen(network, addr)
if err != nil {
return err
}
defer lis.Close()
srv := rpc.NewServer()
if err := srv.RegisterName("UserService", x); err != nil {
return err
}
for {
conn, err := lis.Accept()
if err != nil {
log.Fatalf("lis.Accept(): %v\n", err)
}
go srv.ServeCodec(protorpc.NewServerCodec(conn))
}
}
type UserServiceClient struct {
*rpc.Client
}
// NewUserServiceClient returns a UserService rpc.Client and stub to handle
// requests to the set of UserService at the other end of the connection.
func NewUserServiceClient(conn io.ReadWriteCloser) (*UserServiceClient, *rpc.Client) {
c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
return &UserServiceClient{c}, c
}
func (c *UserServiceClient) GetByToken(in *UserRequest, out *UserResponse) error {
return c.Call("UserService.GetByToken", in, out)
}
func (c *UserServiceClient) Login(in *LoginRequest, out *LoginResponse) error {
return c.Call("UserService.Login", in, out)
}
// DialUserService connects to an UserService at the specified network address.
func DialUserService(network, addr string) (*UserServiceClient, *rpc.Client, error) {
c, err := protorpc.Dial(network, addr)
if err != nil {
return nil, nil, err
}
return &UserServiceClient{c}, c, nil
}
// DialUserServiceTimeout connects to an UserService at the specified network address.
func DialUserServiceTimeout(network, addr string,
timeout time.Duration) (*UserServiceClient, *rpc.Client, error) {
c, err := protorpc.DialTimeout(network, addr, timeout)
if err != nil {
return nil, nil, err
}
return &UserServiceClient{c}, c, nil
}