hello

package
v0.0.0-...-4be93eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

README

Hello Protobuf Messages and Services

Generating the code

$ go get -a github.com/golang/protobuf/protoc-gen-go

From this directory generate the go source using the protoc tool with the Go plugin:

$ protoc --go_out=plugins=grpc:. hello.proto 

Documentation

Overview

Package hello is a generated protocol buffer package.

It is generated from these files:

hello.proto

It has these top-level messages:

Request
Response
LoginRequest
LoginResponse
User

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAuthServer

func RegisterAuthServer(s *grpc.Server, srv AuthServer)

func RegisterHelloServer

func RegisterHelloServer(s *grpc.Server, srv HelloServer)

Types

type AuthClient

type AuthClient interface {
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
}

func NewAuthClient

func NewAuthClient(cc *grpc.ClientConn) AuthClient

type AuthServer

type AuthServer interface {
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
}

type HelloClient

type HelloClient interface {
	// Sends a greeting.
	Say(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

func NewHelloClient

func NewHelloClient(cc *grpc.ClientConn) HelloClient

type HelloServer

type HelloServer interface {
	// Sends a greeting.
	Say(context.Context, *Request) (*Response, error)
}

type LoginRequest

type LoginRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"`
}

The login request message containing the username and password.

func (*LoginRequest) Descriptor

func (*LoginRequest) Descriptor() ([]byte, []int)

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) Reset

func (m *LoginRequest) Reset()

func (*LoginRequest) String

func (m *LoginRequest) String() string

type LoginResponse

type LoginResponse struct {
	Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"`
}

The login response message containing the JWT token.

func (*LoginResponse) Descriptor

func (*LoginResponse) Descriptor() ([]byte, []int)

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) Reset

func (m *LoginResponse) Reset()

func (*LoginResponse) String

func (m *LoginResponse) String() string

type Request

type Request struct {
	Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}

The request message containing the user's name.

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

type Response

type Response struct {
	Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
}

The response message containing the greeting.

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

type User

type User struct {
	Email        string `protobuf:"bytes,1,opt,name=email" json:"email,omitempty"`
	Username     string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
	PasswordHash string `protobuf:"bytes,3,opt,name=passwordHash" json:"passwordHash,omitempty"`
	IsAdmin      bool   `protobuf:"varint,4,opt,name=isAdmin" json:"isAdmin,omitempty"`
}

func (*User) Descriptor

func (*User) Descriptor() ([]byte, []int)

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) Reset

func (m *User) Reset()

func (*User) String

func (m *User) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL