business_v1

package
v0.0.0-...-61a2164 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package business_v1 is a generated twirp stub package. This code was generated with github.com/bilibili/twirp/protoc-gen-twirp v5.5.0.

It is generated from these files:

service.proto

Index

Constants

View Source
const BusinessPathPrefix = "/twirp/business.v1.Business/"

BusinessPathPrefix is used for all URL paths on a twirp Business server. Requests are always: POST BusinessPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.

Variables

This section is empty.

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type Business

type Business interface {
	Get(context.Context, *GetReq) (*GetResp, error)

	Set(context.Context, *SetReq) (*SetResp, error)

	Del(context.Context, *DelReq) (*DefaultResp, error)
}

func NewBusinessJSONClient

func NewBusinessJSONClient(addr string, client HTTPClient) Business

NewBusinessJSONClient creates a JSON client that implements the Business interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewBusinessProtobufClient

func NewBusinessProtobufClient(addr string, client HTTPClient) Business

NewBusinessProtobufClient creates a Protobuf client that implements the Business interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type DefaultResp

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

func (*DefaultResp) Descriptor

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

func (*DefaultResp) GetCode

func (m *DefaultResp) GetCode() int32

func (*DefaultResp) GetMsg

func (m *DefaultResp) GetMsg() string

func (*DefaultResp) ProtoMessage

func (*DefaultResp) ProtoMessage()

func (*DefaultResp) Reset

func (m *DefaultResp) Reset()

func (*DefaultResp) String

func (m *DefaultResp) String() string

func (*DefaultResp) XXX_DiscardUnknown

func (m *DefaultResp) XXX_DiscardUnknown()

func (*DefaultResp) XXX_Marshal

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

func (*DefaultResp) XXX_Merge

func (dst *DefaultResp) XXX_Merge(src proto.Message)

func (*DefaultResp) XXX_Size

func (m *DefaultResp) XXX_Size() int

func (*DefaultResp) XXX_Unmarshal

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

type DelReq

type DelReq struct {
	Id                   int32    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DelReq) Descriptor

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

func (*DelReq) GetId

func (m *DelReq) GetId() int32

func (*DelReq) ProtoMessage

func (*DelReq) ProtoMessage()

func (*DelReq) Reset

func (m *DelReq) Reset()

func (*DelReq) String

func (m *DelReq) String() string

func (*DelReq) XXX_DiscardUnknown

func (m *DelReq) XXX_DiscardUnknown()

func (*DelReq) XXX_Marshal

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

func (*DelReq) XXX_Merge

func (dst *DelReq) XXX_Merge(src proto.Message)

func (*DelReq) XXX_Size

func (m *DelReq) XXX_Size() int

func (*DelReq) XXX_Unmarshal

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

type GetReq

type GetReq struct {
	Id                   int32    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetReq) Descriptor

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

func (*GetReq) GetId

func (m *GetReq) GetId() int32

func (*GetReq) ProtoMessage

func (*GetReq) ProtoMessage()

func (*GetReq) Reset

func (m *GetReq) Reset()

func (*GetReq) String

func (m *GetReq) String() string

func (*GetReq) XXX_DiscardUnknown

func (m *GetReq) XXX_DiscardUnknown()

func (*GetReq) XXX_Marshal

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

func (*GetReq) XXX_Merge

func (dst *GetReq) XXX_Merge(src proto.Message)

func (*GetReq) XXX_Size

func (m *GetReq) XXX_Size() int

func (*GetReq) XXX_Unmarshal

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

type GetResp

type GetResp struct {
	Id                   int32        `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string       `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Time                 string       `protobuf:"bytes,3,opt,name=time,proto3" json:"time,omitempty"`
	Data                 *DefaultResp `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*GetResp) Descriptor

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

func (*GetResp) GetData

func (m *GetResp) GetData() *DefaultResp

func (*GetResp) GetId

func (m *GetResp) GetId() int32

func (*GetResp) GetName

func (m *GetResp) GetName() string

func (*GetResp) GetTime

func (m *GetResp) GetTime() string

func (*GetResp) ProtoMessage

func (*GetResp) ProtoMessage()

func (*GetResp) Reset

func (m *GetResp) Reset()

func (*GetResp) String

func (m *GetResp) String() string

func (*GetResp) XXX_DiscardUnknown

func (m *GetResp) XXX_DiscardUnknown()

func (*GetResp) XXX_Marshal

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

func (*GetResp) XXX_Merge

func (dst *GetResp) XXX_Merge(src proto.Message)

func (*GetResp) XXX_Size

func (m *GetResp) XXX_Size() int

func (*GetResp) XXX_Unmarshal

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

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type SetReq

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

func (*SetReq) Descriptor

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

func (*SetReq) GetName

func (m *SetReq) GetName() string

func (*SetReq) ProtoMessage

func (*SetReq) ProtoMessage()

func (*SetReq) Reset

func (m *SetReq) Reset()

func (*SetReq) String

func (m *SetReq) String() string

func (*SetReq) XXX_DiscardUnknown

func (m *SetReq) XXX_DiscardUnknown()

func (*SetReq) XXX_Marshal

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

func (*SetReq) XXX_Merge

func (dst *SetReq) XXX_Merge(src proto.Message)

func (*SetReq) XXX_Size

func (m *SetReq) XXX_Size() int

func (*SetReq) XXX_Unmarshal

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

type SetResp

type SetResp struct {
	Id                   int32        `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Data                 *DefaultResp `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*SetResp) Descriptor

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

func (*SetResp) GetData

func (m *SetResp) GetData() *DefaultResp

func (*SetResp) GetId

func (m *SetResp) GetId() int32

func (*SetResp) ProtoMessage

func (*SetResp) ProtoMessage()

func (*SetResp) Reset

func (m *SetResp) Reset()

func (*SetResp) String

func (m *SetResp) String() string

func (*SetResp) XXX_DiscardUnknown

func (m *SetResp) XXX_DiscardUnknown()

func (*SetResp) XXX_Marshal

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

func (*SetResp) XXX_Merge

func (dst *SetResp) XXX_Merge(src proto.Message)

func (*SetResp) XXX_Size

func (m *SetResp) XXX_Size() int

func (*SetResp) XXX_Unmarshal

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

type TwirpServer

type TwirpServer interface {
	http.Handler
	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)
	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewBusinessServer

func NewBusinessServer(svc Business, hooks *twirp.ServerHooks) TwirpServer

Jump to

Keyboard shortcuts

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