Documentation ¶
Overview ¶
Package cardv1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterCardServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterCardServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CardServiceClient) error
- func RegisterCardServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterCardServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CardServiceServer) error
- func RegisterCardServiceServer(s grpc.ServiceRegistrar, srv CardServiceServer)
- type CardInfo
- type CardServiceClient
- type CardServiceServer
- type Consumption
- func (*Consumption) Descriptor() ([]byte, []int)deprecated
- func (x *Consumption) GetCreateTime() int64
- func (x *Consumption) GetDeviceName() string
- func (x *Consumption) GetDeviceNum() string
- func (x *Consumption) GetFeeName() string
- func (x *Consumption) GetRemaining() float64
- func (x *Consumption) GetTotalFee() float64
- func (*Consumption) ProtoMessage()
- func (x *Consumption) ProtoReflect() protoreflect.Message
- func (x *Consumption) Reset()
- func (x *Consumption) String() string
- type GetCardBalanceResponse
- func (*GetCardBalanceResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetCardBalanceResponse) GetData() float32
- func (x *GetCardBalanceResponse) GetError() int32
- func (x *GetCardBalanceResponse) GetMsg() string
- func (*GetCardBalanceResponse) ProtoMessage()
- func (x *GetCardBalanceResponse) ProtoReflect() protoreflect.Message
- func (x *GetCardBalanceResponse) Reset()
- func (x *GetCardBalanceResponse) String() string
- type GetCardConsumeResponse
- func (*GetCardConsumeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetCardConsumeResponse) GetData() []*Consumption
- func (x *GetCardConsumeResponse) GetError() int32
- func (x *GetCardConsumeResponse) GetMsg() string
- func (*GetCardConsumeResponse) ProtoMessage()
- func (x *GetCardConsumeResponse) ProtoReflect() protoreflect.Message
- func (x *GetCardConsumeResponse) Reset()
- func (x *GetCardConsumeResponse) String() string
- type GetCardInfoResponse
- func (*GetCardInfoResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetCardInfoResponse) GetData() *CardInfo
- func (x *GetCardInfoResponse) GetError() int32
- func (x *GetCardInfoResponse) GetMsg() string
- func (*GetCardInfoResponse) ProtoMessage()
- func (x *GetCardInfoResponse) ProtoReflect() protoreflect.Message
- func (x *GetCardInfoResponse) Reset()
- func (x *GetCardInfoResponse) String() string
- type UnimplementedCardServiceServer
- func (UnimplementedCardServiceServer) GetCardBalance(context.Context, *emptypb.Empty) (*GetCardBalanceResponse, error)
- func (UnimplementedCardServiceServer) GetCardConsume(context.Context, *emptypb.Empty) (*GetCardConsumeResponse, error)
- func (UnimplementedCardServiceServer) GetCardInfo(context.Context, *emptypb.Empty) (*GetCardInfoResponse, error)
- type UnsafeCardServiceServer
Constants ¶
const ( CardService_GetCardInfo_FullMethodName = "/campusapis.card.v1.CardService/GetCardInfo" CardService_GetCardBalance_FullMethodName = "/campusapis.card.v1.CardService/GetCardBalance" CardService_GetCardConsume_FullMethodName = "/campusapis.card.v1.CardService/GetCardConsume" )
Variables ¶
var CardService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "campusapis.card.v1.CardService", HandlerType: (*CardServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetCardInfo", Handler: _CardService_GetCardInfo_Handler, }, { MethodName: "GetCardBalance", Handler: _CardService_GetCardBalance_Handler, }, { MethodName: "GetCardConsume", Handler: _CardService_GetCardConsume_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "campusapis/card/v1/card.proto", }
CardService_ServiceDesc is the grpc.ServiceDesc for CardService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_campusapis_card_v1_card_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCardServiceHandler ¶
func RegisterCardServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterCardServiceHandler registers the http handlers for service CardService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterCardServiceHandlerClient ¶
func RegisterCardServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CardServiceClient) error
RegisterCardServiceHandlerClient registers the http handlers for service CardService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CardServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CardServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "CardServiceClient" to call the correct interceptors.
func RegisterCardServiceHandlerFromEndpoint ¶
func RegisterCardServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterCardServiceHandlerFromEndpoint is same as RegisterCardServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterCardServiceHandlerServer ¶
func RegisterCardServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CardServiceServer) error
RegisterCardServiceHandlerServer registers the http handlers for service CardService to "mux". UnaryRPC :call CardServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCardServiceHandlerFromEndpoint instead.
func RegisterCardServiceServer ¶
func RegisterCardServiceServer(s grpc.ServiceRegistrar, srv CardServiceServer)
Types ¶
type CardInfo ¶
type CardInfo struct { // 余额,精确到小数点后两位,单位元 Remaining float32 `protobuf:"fixed32,1,opt,name=remaining,proto3" json:"remaining,omitempty"` // 交易记录 Flow []*Consumption `protobuf:"bytes,2,rep,name=flow,proto3" json:"flow,omitempty"` // contains filtered or unexported fields }
func (*CardInfo) Descriptor
deprecated
func (*CardInfo) GetFlow ¶
func (x *CardInfo) GetFlow() []*Consumption
func (*CardInfo) GetRemaining ¶
func (*CardInfo) ProtoMessage ¶
func (*CardInfo) ProtoMessage()
func (*CardInfo) ProtoReflect ¶
func (x *CardInfo) ProtoReflect() protoreflect.Message
type CardServiceClient ¶
type CardServiceClient interface { // 查询校园卡信息 GetCardInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCardInfoResponse, error) // 查询校园卡余额 GetCardBalance(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCardBalanceResponse, error) // 查询校园卡消费记录 GetCardConsume(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCardConsumeResponse, error) }
CardServiceClient is the client API for CardService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewCardServiceClient ¶
func NewCardServiceClient(cc grpc.ClientConnInterface) CardServiceClient
type CardServiceServer ¶
type CardServiceServer interface { // 查询校园卡信息 GetCardInfo(context.Context, *emptypb.Empty) (*GetCardInfoResponse, error) // 查询校园卡余额 GetCardBalance(context.Context, *emptypb.Empty) (*GetCardBalanceResponse, error) // 查询校园卡消费记录 GetCardConsume(context.Context, *emptypb.Empty) (*GetCardConsumeResponse, error) // contains filtered or unexported methods }
CardServiceServer is the server API for CardService service. All implementations must embed UnimplementedCardServiceServer for forward compatibility
type Consumption ¶
type Consumption struct { // 交易设备名称 DeviceName string `protobuf:"bytes,1,opt,name=deviceName,proto3" json:"deviceName,omitempty"` // 交易设备代码 DeviceNum string `protobuf:"bytes,2,opt,name=deviceNum,proto3" json:"deviceNum,omitempty"` // 交易金额,精确到小数点后两位,单位元 // 负数为消费,正数为充值 TotalFee float64 `protobuf:"fixed64,3,opt,name=totalFee,proto3" json:"totalFee,omitempty"` // 交易名称 FeeName string `protobuf:"bytes,4,opt,name=feeName,proto3" json:"feeName,omitempty"` // 交易后余额 Remaining float64 `protobuf:"fixed64,5,opt,name=remaining,proto3" json:"remaining,omitempty"` // 交易事件发生时间戳 CreateTime int64 `protobuf:"varint,6,opt,name=createTime,proto3" json:"createTime,omitempty"` // contains filtered or unexported fields }
func (*Consumption) Descriptor
deprecated
func (*Consumption) Descriptor() ([]byte, []int)
Deprecated: Use Consumption.ProtoReflect.Descriptor instead.
func (*Consumption) GetCreateTime ¶
func (x *Consumption) GetCreateTime() int64
func (*Consumption) GetDeviceName ¶
func (x *Consumption) GetDeviceName() string
func (*Consumption) GetDeviceNum ¶
func (x *Consumption) GetDeviceNum() string
func (*Consumption) GetFeeName ¶
func (x *Consumption) GetFeeName() string
func (*Consumption) GetRemaining ¶
func (x *Consumption) GetRemaining() float64
func (*Consumption) GetTotalFee ¶
func (x *Consumption) GetTotalFee() float64
func (*Consumption) ProtoMessage ¶
func (*Consumption) ProtoMessage()
func (*Consumption) ProtoReflect ¶
func (x *Consumption) ProtoReflect() protoreflect.Message
func (*Consumption) Reset ¶
func (x *Consumption) Reset()
func (*Consumption) String ¶
func (x *Consumption) String() string
type GetCardBalanceResponse ¶
type GetCardBalanceResponse struct { Error int32 `protobuf:"varint,1,opt,name=error,proto3" json:"error,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` // remaining 余额 Data float32 `protobuf:"fixed32,3,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*GetCardBalanceResponse) Descriptor
deprecated
func (*GetCardBalanceResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetCardBalanceResponse.ProtoReflect.Descriptor instead.
func (*GetCardBalanceResponse) GetData ¶
func (x *GetCardBalanceResponse) GetData() float32
func (*GetCardBalanceResponse) GetError ¶
func (x *GetCardBalanceResponse) GetError() int32
func (*GetCardBalanceResponse) GetMsg ¶
func (x *GetCardBalanceResponse) GetMsg() string
func (*GetCardBalanceResponse) ProtoMessage ¶
func (*GetCardBalanceResponse) ProtoMessage()
func (*GetCardBalanceResponse) ProtoReflect ¶
func (x *GetCardBalanceResponse) ProtoReflect() protoreflect.Message
func (*GetCardBalanceResponse) Reset ¶
func (x *GetCardBalanceResponse) Reset()
func (*GetCardBalanceResponse) String ¶
func (x *GetCardBalanceResponse) String() string
type GetCardConsumeResponse ¶
type GetCardConsumeResponse struct { Error int32 `protobuf:"varint,1,opt,name=error,proto3" json:"error,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Data []*Consumption `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*GetCardConsumeResponse) Descriptor
deprecated
func (*GetCardConsumeResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetCardConsumeResponse.ProtoReflect.Descriptor instead.
func (*GetCardConsumeResponse) GetData ¶
func (x *GetCardConsumeResponse) GetData() []*Consumption
func (*GetCardConsumeResponse) GetError ¶
func (x *GetCardConsumeResponse) GetError() int32
func (*GetCardConsumeResponse) GetMsg ¶
func (x *GetCardConsumeResponse) GetMsg() string
func (*GetCardConsumeResponse) ProtoMessage ¶
func (*GetCardConsumeResponse) ProtoMessage()
func (*GetCardConsumeResponse) ProtoReflect ¶
func (x *GetCardConsumeResponse) ProtoReflect() protoreflect.Message
func (*GetCardConsumeResponse) Reset ¶
func (x *GetCardConsumeResponse) Reset()
func (*GetCardConsumeResponse) String ¶
func (x *GetCardConsumeResponse) String() string
type GetCardInfoResponse ¶
type GetCardInfoResponse struct { Error int32 `protobuf:"varint,1,opt,name=error,proto3" json:"error,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Data *CardInfo `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*GetCardInfoResponse) Descriptor
deprecated
func (*GetCardInfoResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetCardInfoResponse.ProtoReflect.Descriptor instead.
func (*GetCardInfoResponse) GetData ¶
func (x *GetCardInfoResponse) GetData() *CardInfo
func (*GetCardInfoResponse) GetError ¶
func (x *GetCardInfoResponse) GetError() int32
func (*GetCardInfoResponse) GetMsg ¶
func (x *GetCardInfoResponse) GetMsg() string
func (*GetCardInfoResponse) ProtoMessage ¶
func (*GetCardInfoResponse) ProtoMessage()
func (*GetCardInfoResponse) ProtoReflect ¶
func (x *GetCardInfoResponse) ProtoReflect() protoreflect.Message
func (*GetCardInfoResponse) Reset ¶
func (x *GetCardInfoResponse) Reset()
func (*GetCardInfoResponse) String ¶
func (x *GetCardInfoResponse) String() string
type UnimplementedCardServiceServer ¶
type UnimplementedCardServiceServer struct { }
UnimplementedCardServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedCardServiceServer) GetCardBalance ¶
func (UnimplementedCardServiceServer) GetCardBalance(context.Context, *emptypb.Empty) (*GetCardBalanceResponse, error)
func (UnimplementedCardServiceServer) GetCardConsume ¶
func (UnimplementedCardServiceServer) GetCardConsume(context.Context, *emptypb.Empty) (*GetCardConsumeResponse, error)
func (UnimplementedCardServiceServer) GetCardInfo ¶
func (UnimplementedCardServiceServer) GetCardInfo(context.Context, *emptypb.Empty) (*GetCardInfoResponse, error)
type UnsafeCardServiceServer ¶
type UnsafeCardServiceServer interface {
// contains filtered or unexported methods
}
UnsafeCardServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CardServiceServer will result in compilation errors.