filecenter.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Code generated by goctl. DO NOT EDIT!
  2. // Source: fileCenter.proto
  3. package filecenter
  4. import (
  5. "context"
  6. "bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/pb"
  7. "github.com/zeromicro/go-zero/zrpc"
  8. "google.golang.org/grpc"
  9. )
  10. type (
  11. DeleteFileReq = pb.DeleteFileReq
  12. Resp = pb.Resp
  13. UploadReq = pb.UploadReq
  14. UploadResp = pb.UploadResp
  15. FileCenter interface {
  16. // 文件上传
  17. Upload(ctx context.Context, in *UploadReq, opts ...grpc.CallOption) (*UploadResp, error)
  18. // 文件删除
  19. Delete(ctx context.Context, in *DeleteFileReq, opts ...grpc.CallOption) (*Resp, error)
  20. }
  21. defaultFileCenter struct {
  22. cli zrpc.Client
  23. }
  24. )
  25. func NewFileCenter(cli zrpc.Client) FileCenter {
  26. return &defaultFileCenter{
  27. cli: cli,
  28. }
  29. }
  30. // 文件上传
  31. func (m *defaultFileCenter) Upload(ctx context.Context, in *UploadReq, opts ...grpc.CallOption) (*UploadResp, error) {
  32. client := pb.NewFileCenterClient(m.cli.Conn())
  33. return client.Upload(ctx, in, opts...)
  34. }
  35. // 文件删除
  36. func (m *defaultFileCenter) Delete(ctx context.Context, in *DeleteFileReq, opts ...grpc.CallOption) (*Resp, error) {
  37. client := pb.NewFileCenterClient(m.cli.Conn())
  38. return client.Delete(ctx, in, opts...)
  39. }