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
- func WriteError(resp http.ResponseWriter, err error)
- type Business
- type DefaultResp
- func (*DefaultResp) Descriptor() ([]byte, []int)
- func (m *DefaultResp) GetCode() int32
- func (m *DefaultResp) GetMsg() string
- func (*DefaultResp) ProtoMessage()
- func (m *DefaultResp) Reset()
- func (m *DefaultResp) String() string
- func (m *DefaultResp) XXX_DiscardUnknown()
- func (m *DefaultResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *DefaultResp) XXX_Merge(src proto.Message)
- func (m *DefaultResp) XXX_Size() int
- func (m *DefaultResp) XXX_Unmarshal(b []byte) error
- type DelReq
- func (*DelReq) Descriptor() ([]byte, []int)
- func (m *DelReq) GetId() int32
- func (*DelReq) ProtoMessage()
- func (m *DelReq) Reset()
- func (m *DelReq) String() string
- func (m *DelReq) XXX_DiscardUnknown()
- func (m *DelReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *DelReq) XXX_Merge(src proto.Message)
- func (m *DelReq) XXX_Size() int
- func (m *DelReq) XXX_Unmarshal(b []byte) error
- type GetReq
- func (*GetReq) Descriptor() ([]byte, []int)
- func (m *GetReq) GetId() int32
- func (*GetReq) ProtoMessage()
- func (m *GetReq) Reset()
- func (m *GetReq) String() string
- func (m *GetReq) XXX_DiscardUnknown()
- func (m *GetReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *GetReq) XXX_Merge(src proto.Message)
- func (m *GetReq) XXX_Size() int
- func (m *GetReq) XXX_Unmarshal(b []byte) error
- type GetResp
- func (*GetResp) Descriptor() ([]byte, []int)
- func (m *GetResp) GetData() *DefaultResp
- func (m *GetResp) GetId() int32
- func (m *GetResp) GetName() string
- func (m *GetResp) GetTime() string
- func (*GetResp) ProtoMessage()
- func (m *GetResp) Reset()
- func (m *GetResp) String() string
- func (m *GetResp) XXX_DiscardUnknown()
- func (m *GetResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *GetResp) XXX_Merge(src proto.Message)
- func (m *GetResp) XXX_Size() int
- func (m *GetResp) XXX_Unmarshal(b []byte) error
- type HTTPClient
- type SetReq
- func (*SetReq) Descriptor() ([]byte, []int)
- func (m *SetReq) GetName() string
- func (*SetReq) ProtoMessage()
- func (m *SetReq) Reset()
- func (m *SetReq) String() string
- func (m *SetReq) XXX_DiscardUnknown()
- func (m *SetReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SetReq) XXX_Merge(src proto.Message)
- func (m *SetReq) XXX_Size() int
- func (m *SetReq) XXX_Unmarshal(b []byte) error
- type SetResp
- func (*SetResp) Descriptor() ([]byte, []int)
- func (m *SetResp) GetData() *DefaultResp
- func (m *SetResp) GetId() int32
- func (*SetResp) ProtoMessage()
- func (m *SetResp) Reset()
- func (m *SetResp) String() string
- func (m *SetResp) XXX_DiscardUnknown()
- func (m *SetResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SetResp) XXX_Merge(src proto.Message)
- func (m *SetResp) XXX_Size() int
- func (m *SetResp) XXX_Unmarshal(b []byte) error
- type TwirpServer
Constants ¶
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) ProtoMessage ¶
func (*DelReq) ProtoMessage()
func (*DelReq) XXX_DiscardUnknown ¶
func (m *DelReq) XXX_DiscardUnknown()
func (*DelReq) XXX_Marshal ¶
func (*DelReq) XXX_Unmarshal ¶
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) ProtoMessage ¶
func (*GetReq) ProtoMessage()
func (*GetReq) XXX_DiscardUnknown ¶
func (m *GetReq) XXX_DiscardUnknown()
func (*GetReq) XXX_Marshal ¶
func (*GetReq) XXX_Unmarshal ¶
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) GetData ¶
func (m *GetResp) GetData() *DefaultResp
func (*GetResp) ProtoMessage ¶
func (*GetResp) ProtoMessage()
func (*GetResp) XXX_DiscardUnknown ¶
func (m *GetResp) XXX_DiscardUnknown()
func (*GetResp) XXX_Marshal ¶
func (*GetResp) XXX_Unmarshal ¶
type HTTPClient ¶
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) ProtoMessage ¶
func (*SetReq) ProtoMessage()
func (*SetReq) XXX_DiscardUnknown ¶
func (m *SetReq) XXX_DiscardUnknown()
func (*SetReq) XXX_Marshal ¶
func (*SetReq) XXX_Unmarshal ¶
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) GetData ¶
func (m *SetResp) GetData() *DefaultResp
func (*SetResp) ProtoMessage ¶
func (*SetResp) ProtoMessage()
func (*SetResp) XXX_DiscardUnknown ¶
func (m *SetResp) XXX_DiscardUnknown()
func (*SetResp) XXX_Marshal ¶
func (*SetResp) XXX_Unmarshal ¶
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