bookstore

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package bookstore is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBookstoreHandler

func RegisterBookstoreHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterBookstoreHandler registers the http handlers for service Bookstore to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterBookstoreHandlerClient

func RegisterBookstoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BookstoreClient) error

RegisterBookstoreHandlerClient registers the http handlers for service Bookstore to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BookstoreClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BookstoreClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BookstoreClient" to call the correct interceptors.

func RegisterBookstoreHandlerFromEndpoint

func RegisterBookstoreHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterBookstoreHandlerFromEndpoint is same as RegisterBookstoreHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterBookstoreServer

func RegisterBookstoreServer(s *grpc.Server, srv BookstoreServer)

func RunProxy

func RunProxy()

func RunServer

func RunServer()

Types

type Book

type Book struct {
	Author               string   `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Title                string   `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Book) Descriptor

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

func (*Book) GetAuthor

func (m *Book) GetAuthor() string

func (*Book) GetName

func (m *Book) GetName() string

func (*Book) GetTitle

func (m *Book) GetTitle() string

func (*Book) ProtoMessage

func (*Book) ProtoMessage()

func (*Book) Reset

func (m *Book) Reset()

func (*Book) String

func (m *Book) String() string

func (*Book) XXX_DiscardUnknown

func (m *Book) XXX_DiscardUnknown()

func (*Book) XXX_Marshal

func (m *Book) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Book) XXX_Merge

func (m *Book) XXX_Merge(src proto.Message)

func (*Book) XXX_Size

func (m *Book) XXX_Size() int

func (*Book) XXX_Unmarshal

func (m *Book) XXX_Unmarshal(b []byte) error

type BookstoreClient

type BookstoreClient interface {
	ListShelves(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ListShelvesResponse, error)
	CreateShelf(ctx context.Context, in *CreateShelfParameters, opts ...grpc.CallOption) (*Shelf, error)
	DeleteShelves(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
	GetShelf(ctx context.Context, in *GetShelfParameters, opts ...grpc.CallOption) (*Shelf, error)
	DeleteShelf(ctx context.Context, in *DeleteShelfParameters, opts ...grpc.CallOption) (*empty.Empty, error)
	ListBooks(ctx context.Context, in *ListBooksParameters, opts ...grpc.CallOption) (*ListBooksResponse, error)
	CreateBook(ctx context.Context, in *CreateBookParameters, opts ...grpc.CallOption) (*Book, error)
	GetBook(ctx context.Context, in *GetBookParameters, opts ...grpc.CallOption) (*Book, error)
	DeleteBook(ctx context.Context, in *DeleteBookParameters, opts ...grpc.CallOption) (*empty.Empty, error)
}

BookstoreClient is the client API for Bookstore service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewBookstoreClient

func NewBookstoreClient(cc *grpc.ClientConn) BookstoreClient

type BookstoreServer

BookstoreServer is the server API for Bookstore service.

type CreateBookParameters

type CreateBookParameters struct {
	Shelf                int64    `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"`
	Book                 *Book    `protobuf:"bytes,2,opt,name=book,proto3" json:"book,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateBookParameters) Descriptor

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

func (*CreateBookParameters) GetBook

func (m *CreateBookParameters) GetBook() *Book

func (*CreateBookParameters) GetShelf

func (m *CreateBookParameters) GetShelf() int64

func (*CreateBookParameters) ProtoMessage

func (*CreateBookParameters) ProtoMessage()

func (*CreateBookParameters) Reset

func (m *CreateBookParameters) Reset()

func (*CreateBookParameters) String

func (m *CreateBookParameters) String() string

func (*CreateBookParameters) XXX_DiscardUnknown

func (m *CreateBookParameters) XXX_DiscardUnknown()

func (*CreateBookParameters) XXX_Marshal

func (m *CreateBookParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateBookParameters) XXX_Merge

func (m *CreateBookParameters) XXX_Merge(src proto.Message)

func (*CreateBookParameters) XXX_Size

func (m *CreateBookParameters) XXX_Size() int

func (*CreateBookParameters) XXX_Unmarshal

func (m *CreateBookParameters) XXX_Unmarshal(b []byte) error

type CreateShelfParameters

type CreateShelfParameters struct {
	Shelf                *Shelf   `protobuf:"bytes,1,opt,name=shelf,proto3" json:"shelf,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateShelfParameters) Descriptor

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

func (*CreateShelfParameters) GetShelf

func (m *CreateShelfParameters) GetShelf() *Shelf

func (*CreateShelfParameters) ProtoMessage

func (*CreateShelfParameters) ProtoMessage()

func (*CreateShelfParameters) Reset

func (m *CreateShelfParameters) Reset()

func (*CreateShelfParameters) String

func (m *CreateShelfParameters) String() string

func (*CreateShelfParameters) XXX_DiscardUnknown

func (m *CreateShelfParameters) XXX_DiscardUnknown()

func (*CreateShelfParameters) XXX_Marshal

func (m *CreateShelfParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateShelfParameters) XXX_Merge

func (m *CreateShelfParameters) XXX_Merge(src proto.Message)

func (*CreateShelfParameters) XXX_Size

func (m *CreateShelfParameters) XXX_Size() int

func (*CreateShelfParameters) XXX_Unmarshal

func (m *CreateShelfParameters) XXX_Unmarshal(b []byte) error

type DeleteBookParameters

type DeleteBookParameters struct {
	Shelf                int64    `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"`
	Book                 int64    `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteBookParameters) Descriptor

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

func (*DeleteBookParameters) GetBook

func (m *DeleteBookParameters) GetBook() int64

func (*DeleteBookParameters) GetShelf

func (m *DeleteBookParameters) GetShelf() int64

func (*DeleteBookParameters) ProtoMessage

func (*DeleteBookParameters) ProtoMessage()

func (*DeleteBookParameters) Reset

func (m *DeleteBookParameters) Reset()

func (*DeleteBookParameters) String

func (m *DeleteBookParameters) String() string

func (*DeleteBookParameters) XXX_DiscardUnknown

func (m *DeleteBookParameters) XXX_DiscardUnknown()

func (*DeleteBookParameters) XXX_Marshal

func (m *DeleteBookParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteBookParameters) XXX_Merge

func (m *DeleteBookParameters) XXX_Merge(src proto.Message)

func (*DeleteBookParameters) XXX_Size

func (m *DeleteBookParameters) XXX_Size() int

func (*DeleteBookParameters) XXX_Unmarshal

func (m *DeleteBookParameters) XXX_Unmarshal(b []byte) error

type DeleteShelfParameters

type DeleteShelfParameters struct {
	Shelf                int64    `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteShelfParameters) Descriptor

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

func (*DeleteShelfParameters) GetShelf

func (m *DeleteShelfParameters) GetShelf() int64

func (*DeleteShelfParameters) ProtoMessage

func (*DeleteShelfParameters) ProtoMessage()

func (*DeleteShelfParameters) Reset

func (m *DeleteShelfParameters) Reset()

func (*DeleteShelfParameters) String

func (m *DeleteShelfParameters) String() string

func (*DeleteShelfParameters) XXX_DiscardUnknown

func (m *DeleteShelfParameters) XXX_DiscardUnknown()

func (*DeleteShelfParameters) XXX_Marshal

func (m *DeleteShelfParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteShelfParameters) XXX_Merge

func (m *DeleteShelfParameters) XXX_Merge(src proto.Message)

func (*DeleteShelfParameters) XXX_Size

func (m *DeleteShelfParameters) XXX_Size() int

func (*DeleteShelfParameters) XXX_Unmarshal

func (m *DeleteShelfParameters) XXX_Unmarshal(b []byte) error

type Error

type Error struct {
	Code                 int32    `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message              string   `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Error) Descriptor

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

func (*Error) GetCode

func (m *Error) GetCode() int32

func (*Error) GetMessage

func (m *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) String

func (m *Error) String() string

func (*Error) XXX_DiscardUnknown

func (m *Error) XXX_DiscardUnknown()

func (*Error) XXX_Marshal

func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Error) XXX_Merge

func (m *Error) XXX_Merge(src proto.Message)

func (*Error) XXX_Size

func (m *Error) XXX_Size() int

func (*Error) XXX_Unmarshal

func (m *Error) XXX_Unmarshal(b []byte) error

type GetBookParameters

type GetBookParameters struct {
	Shelf                int64    `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"`
	Book                 int64    `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetBookParameters) Descriptor

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

func (*GetBookParameters) GetBook

func (m *GetBookParameters) GetBook() int64

func (*GetBookParameters) GetShelf

func (m *GetBookParameters) GetShelf() int64

func (*GetBookParameters) ProtoMessage

func (*GetBookParameters) ProtoMessage()

func (*GetBookParameters) Reset

func (m *GetBookParameters) Reset()

func (*GetBookParameters) String

func (m *GetBookParameters) String() string

func (*GetBookParameters) XXX_DiscardUnknown

func (m *GetBookParameters) XXX_DiscardUnknown()

func (*GetBookParameters) XXX_Marshal

func (m *GetBookParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetBookParameters) XXX_Merge

func (m *GetBookParameters) XXX_Merge(src proto.Message)

func (*GetBookParameters) XXX_Size

func (m *GetBookParameters) XXX_Size() int

func (*GetBookParameters) XXX_Unmarshal

func (m *GetBookParameters) XXX_Unmarshal(b []byte) error

type GetShelfParameters

type GetShelfParameters struct {
	Shelf                int64    `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetShelfParameters) Descriptor

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

func (*GetShelfParameters) GetShelf

func (m *GetShelfParameters) GetShelf() int64

func (*GetShelfParameters) ProtoMessage

func (*GetShelfParameters) ProtoMessage()

func (*GetShelfParameters) Reset

func (m *GetShelfParameters) Reset()

func (*GetShelfParameters) String

func (m *GetShelfParameters) String() string

func (*GetShelfParameters) XXX_DiscardUnknown

func (m *GetShelfParameters) XXX_DiscardUnknown()

func (*GetShelfParameters) XXX_Marshal

func (m *GetShelfParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetShelfParameters) XXX_Merge

func (m *GetShelfParameters) XXX_Merge(src proto.Message)

func (*GetShelfParameters) XXX_Size

func (m *GetShelfParameters) XXX_Size() int

func (*GetShelfParameters) XXX_Unmarshal

func (m *GetShelfParameters) XXX_Unmarshal(b []byte) error

type ListBooksParameters

type ListBooksParameters struct {
	Shelf                int64    `protobuf:"varint,1,opt,name=shelf,proto3" json:"shelf,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ListBooksParameters) Descriptor

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

func (*ListBooksParameters) GetShelf

func (m *ListBooksParameters) GetShelf() int64

func (*ListBooksParameters) ProtoMessage

func (*ListBooksParameters) ProtoMessage()

func (*ListBooksParameters) Reset

func (m *ListBooksParameters) Reset()

func (*ListBooksParameters) String

func (m *ListBooksParameters) String() string

func (*ListBooksParameters) XXX_DiscardUnknown

func (m *ListBooksParameters) XXX_DiscardUnknown()

func (*ListBooksParameters) XXX_Marshal

func (m *ListBooksParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListBooksParameters) XXX_Merge

func (m *ListBooksParameters) XXX_Merge(src proto.Message)

func (*ListBooksParameters) XXX_Size

func (m *ListBooksParameters) XXX_Size() int

func (*ListBooksParameters) XXX_Unmarshal

func (m *ListBooksParameters) XXX_Unmarshal(b []byte) error

type ListBooksResponse

type ListBooksResponse struct {
	Books                []*Book  `protobuf:"bytes,1,rep,name=books,proto3" json:"books,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ListBooksResponse) Descriptor

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

func (*ListBooksResponse) GetBooks

func (m *ListBooksResponse) GetBooks() []*Book

func (*ListBooksResponse) ProtoMessage

func (*ListBooksResponse) ProtoMessage()

func (*ListBooksResponse) Reset

func (m *ListBooksResponse) Reset()

func (*ListBooksResponse) String

func (m *ListBooksResponse) String() string

func (*ListBooksResponse) XXX_DiscardUnknown

func (m *ListBooksResponse) XXX_DiscardUnknown()

func (*ListBooksResponse) XXX_Marshal

func (m *ListBooksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListBooksResponse) XXX_Merge

func (m *ListBooksResponse) XXX_Merge(src proto.Message)

func (*ListBooksResponse) XXX_Size

func (m *ListBooksResponse) XXX_Size() int

func (*ListBooksResponse) XXX_Unmarshal

func (m *ListBooksResponse) XXX_Unmarshal(b []byte) error

type ListShelvesResponse

type ListShelvesResponse struct {
	Shelves              []*Shelf `protobuf:"bytes,1,rep,name=shelves,proto3" json:"shelves,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ListShelvesResponse) Descriptor

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

func (*ListShelvesResponse) GetShelves

func (m *ListShelvesResponse) GetShelves() []*Shelf

func (*ListShelvesResponse) ProtoMessage

func (*ListShelvesResponse) ProtoMessage()

func (*ListShelvesResponse) Reset

func (m *ListShelvesResponse) Reset()

func (*ListShelvesResponse) String

func (m *ListShelvesResponse) String() string

func (*ListShelvesResponse) XXX_DiscardUnknown

func (m *ListShelvesResponse) XXX_DiscardUnknown()

func (*ListShelvesResponse) XXX_Marshal

func (m *ListShelvesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListShelvesResponse) XXX_Merge

func (m *ListShelvesResponse) XXX_Merge(src proto.Message)

func (*ListShelvesResponse) XXX_Size

func (m *ListShelvesResponse) XXX_Size() int

func (*ListShelvesResponse) XXX_Unmarshal

func (m *ListShelvesResponse) XXX_Unmarshal(b []byte) error

type Shelf

type Shelf struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Theme                string   `protobuf:"bytes,2,opt,name=theme,proto3" json:"theme,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Shelf) Descriptor

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

func (*Shelf) GetName

func (m *Shelf) GetName() string

func (*Shelf) GetTheme

func (m *Shelf) GetTheme() string

func (*Shelf) ProtoMessage

func (*Shelf) ProtoMessage()

func (*Shelf) Reset

func (m *Shelf) Reset()

func (*Shelf) String

func (m *Shelf) String() string

func (*Shelf) XXX_DiscardUnknown

func (m *Shelf) XXX_DiscardUnknown()

func (*Shelf) XXX_Marshal

func (m *Shelf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Shelf) XXX_Merge

func (m *Shelf) XXX_Merge(src proto.Message)

func (*Shelf) XXX_Size

func (m *Shelf) XXX_Size() int

func (*Shelf) XXX_Unmarshal

func (m *Shelf) XXX_Unmarshal(b []byte) error

type UnimplementedBookstoreServer

type UnimplementedBookstoreServer struct {
}

UnimplementedBookstoreServer can be embedded to have forward compatible implementations.

func (*UnimplementedBookstoreServer) CreateBook

func (*UnimplementedBookstoreServer) CreateShelf

func (*UnimplementedBookstoreServer) DeleteBook

func (*UnimplementedBookstoreServer) DeleteShelf

func (*UnimplementedBookstoreServer) DeleteShelves

func (*UnimplementedBookstoreServer) DeleteShelves(ctx context.Context, req *empty.Empty) (*empty.Empty, error)

func (*UnimplementedBookstoreServer) GetBook

func (*UnimplementedBookstoreServer) GetShelf

func (*UnimplementedBookstoreServer) ListBooks

func (*UnimplementedBookstoreServer) ListShelves

Jump to

Keyboard shortcuts

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