Documentation
¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterFileManagerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterFileManagerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FileManagerClient) error
- func RegisterFileManagerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterFileManagerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FileManagerServer) error
- func RegisterFileManagerServer(s grpc.ServiceRegistrar, srv FileManagerServer)
- type DeleteFileReply
- type DeleteFileRequest
- type DownloadFileReply
- func (*DownloadFileReply) Descriptor() ([]byte, []int)deprecated
- func (x *DownloadFileReply) GetContentType() string
- func (x *DownloadFileReply) GetFileContent() string
- func (x *DownloadFileReply) GetFileName() string
- func (*DownloadFileReply) ProtoMessage()
- func (x *DownloadFileReply) ProtoReflect() protoreflect.Message
- func (x *DownloadFileReply) Reset()
- func (x *DownloadFileReply) String() string
- type DownloadFileRequest
- func (*DownloadFileRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DownloadFileRequest) GetId() int64
- func (*DownloadFileRequest) ProtoMessage()
- func (x *DownloadFileRequest) ProtoReflect() protoreflect.Message
- func (x *DownloadFileRequest) Reset()
- func (x *DownloadFileRequest) String() string
- type FileInfo
- func (*FileInfo) Descriptor() ([]byte, []int)deprecated
- func (x *FileInfo) GetContentType() string
- func (x *FileInfo) GetDescription() string
- func (x *FileInfo) GetFileName() string
- func (x *FileInfo) GetFilePath() string
- func (x *FileInfo) GetFileSize() int64
- func (x *FileInfo) GetFileType() FileType
- func (x *FileInfo) GetId() int64
- func (x *FileInfo) GetUploadTime() string
- func (*FileInfo) ProtoMessage()
- func (x *FileInfo) ProtoReflect() protoreflect.Message
- func (x *FileInfo) Reset()
- func (x *FileInfo) String() string
- type FileManagerClient
- type FileManagerServer
- type FileType
- type GetFileInfoReply
- type GetFileInfoRequest
- type ListFilesReply
- func (*ListFilesReply) Descriptor() ([]byte, []int)deprecated
- func (x *ListFilesReply) GetFiles() []*FileInfo
- func (x *ListFilesReply) GetTotal() int64
- func (*ListFilesReply) ProtoMessage()
- func (x *ListFilesReply) ProtoReflect() protoreflect.Message
- func (x *ListFilesReply) Reset()
- func (x *ListFilesReply) String() string
- type ListFilesRequest
- func (*ListFilesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListFilesRequest) GetFileType() FileType
- func (x *ListFilesRequest) GetLimit() int32
- func (x *ListFilesRequest) GetOffset() int32
- func (*ListFilesRequest) ProtoMessage()
- func (x *ListFilesRequest) ProtoReflect() protoreflect.Message
- func (x *ListFilesRequest) Reset()
- func (x *ListFilesRequest) String() string
- type UnimplementedFileManagerServer
- func (UnimplementedFileManagerServer) DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileReply, error)
- func (UnimplementedFileManagerServer) DownloadFile(context.Context, *DownloadFileRequest) (*DownloadFileReply, error)
- func (UnimplementedFileManagerServer) GetFileInfo(context.Context, *GetFileInfoRequest) (*GetFileInfoReply, error)
- func (UnimplementedFileManagerServer) ListFiles(context.Context, *ListFilesRequest) (*ListFilesReply, error)
- type UnsafeFileManagerServer
Constants ¶
const ( FileManager_GetFileInfo_FullMethodName = "/filemanager.v1.FileManager/GetFileInfo" FileManager_ListFiles_FullMethodName = "/filemanager.v1.FileManager/ListFiles" FileManager_DeleteFile_FullMethodName = "/filemanager.v1.FileManager/DeleteFile" FileManager_DownloadFile_FullMethodName = "/filemanager.v1.FileManager/DownloadFile" )
Variables ¶
var ( FileType_name = map[int32]string{ 0: "FILE_TYPE_UNSPECIFIED", 1: "FILE_TYPE_RUNTIME", 2: "FILE_TYPE_STATIC", } FileType_value = map[string]int32{ "FILE_TYPE_UNSPECIFIED": 0, "FILE_TYPE_RUNTIME": 1, "FILE_TYPE_STATIC": 2, } )
Enum value maps for FileType.
var FileManager_ServiceDesc = grpc.ServiceDesc{ ServiceName: "filemanager.v1.FileManager", HandlerType: (*FileManagerServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetFileInfo", Handler: _FileManager_GetFileInfo_Handler, }, { MethodName: "ListFiles", Handler: _FileManager_ListFiles_Handler, }, { MethodName: "DeleteFile", Handler: _FileManager_DeleteFile_Handler, }, { MethodName: "DownloadFile", Handler: _FileManager_DownloadFile_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "filemanager/v1/filemanager.proto", }
FileManager_ServiceDesc is the grpc.ServiceDesc for FileManager service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_filemanager_v1_filemanager_proto protoreflect.FileDescriptor
Functions ¶
func RegisterFileManagerHandler ¶
func RegisterFileManagerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterFileManagerHandler registers the http handlers for service FileManager to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterFileManagerHandlerClient ¶
func RegisterFileManagerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FileManagerClient) error
RegisterFileManagerHandlerClient registers the http handlers for service FileManager to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FileManagerClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FileManagerClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "FileManagerClient" to call the correct interceptors.
func RegisterFileManagerHandlerFromEndpoint ¶
func RegisterFileManagerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterFileManagerHandlerFromEndpoint is same as RegisterFileManagerHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterFileManagerHandlerServer ¶
func RegisterFileManagerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FileManagerServer) error
RegisterFileManagerHandlerServer registers the http handlers for service FileManager to "mux". UnaryRPC :call FileManagerServer 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 RegisterFileManagerHandlerFromEndpoint instead.
func RegisterFileManagerServer ¶
func RegisterFileManagerServer(s grpc.ServiceRegistrar, srv FileManagerServer)
Types ¶
type DeleteFileReply ¶
type DeleteFileReply struct {
// 是否成功
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
// contains filtered or unexported fields
}
删除文件响应
func (*DeleteFileReply) Descriptor
deprecated
func (*DeleteFileReply) Descriptor() ([]byte, []int)
Deprecated: Use DeleteFileReply.ProtoReflect.Descriptor instead.
func (*DeleteFileReply) GetSuccess ¶
func (x *DeleteFileReply) GetSuccess() bool
func (*DeleteFileReply) ProtoMessage ¶
func (*DeleteFileReply) ProtoMessage()
func (*DeleteFileReply) ProtoReflect ¶
func (x *DeleteFileReply) ProtoReflect() protoreflect.Message
func (*DeleteFileReply) Reset ¶
func (x *DeleteFileReply) Reset()
func (*DeleteFileReply) String ¶
func (x *DeleteFileReply) String() string
type DeleteFileRequest ¶
type DeleteFileRequest struct {
// 文件ID
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
删除文件请求
func (*DeleteFileRequest) Descriptor
deprecated
func (*DeleteFileRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteFileRequest.ProtoReflect.Descriptor instead.
func (*DeleteFileRequest) GetId ¶
func (x *DeleteFileRequest) GetId() int64
func (*DeleteFileRequest) ProtoMessage ¶
func (*DeleteFileRequest) ProtoMessage()
func (*DeleteFileRequest) ProtoReflect ¶
func (x *DeleteFileRequest) ProtoReflect() protoreflect.Message
func (*DeleteFileRequest) Reset ¶
func (x *DeleteFileRequest) Reset()
func (*DeleteFileRequest) String ¶
func (x *DeleteFileRequest) String() string
type DownloadFileReply ¶
type DownloadFileReply struct {
// 文件内容(Base64编码)
FileContent string `protobuf:"bytes,1,opt,name=fileContent,proto3" json:"fileContent,omitempty"`
// 文件名
FileName string `protobuf:"bytes,2,opt,name=fileName,proto3" json:"fileName,omitempty"`
// 内容类型
ContentType string `protobuf:"bytes,3,opt,name=contentType,proto3" json:"contentType,omitempty"`
// contains filtered or unexported fields
}
下载文件响应
func (*DownloadFileReply) Descriptor
deprecated
func (*DownloadFileReply) Descriptor() ([]byte, []int)
Deprecated: Use DownloadFileReply.ProtoReflect.Descriptor instead.
func (*DownloadFileReply) GetContentType ¶
func (x *DownloadFileReply) GetContentType() string
func (*DownloadFileReply) GetFileContent ¶
func (x *DownloadFileReply) GetFileContent() string
func (*DownloadFileReply) GetFileName ¶
func (x *DownloadFileReply) GetFileName() string
func (*DownloadFileReply) ProtoMessage ¶
func (*DownloadFileReply) ProtoMessage()
func (*DownloadFileReply) ProtoReflect ¶
func (x *DownloadFileReply) ProtoReflect() protoreflect.Message
func (*DownloadFileReply) Reset ¶
func (x *DownloadFileReply) Reset()
func (*DownloadFileReply) String ¶
func (x *DownloadFileReply) String() string
type DownloadFileRequest ¶
type DownloadFileRequest struct {
// 文件ID
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
下载文件请求
func (*DownloadFileRequest) Descriptor
deprecated
func (*DownloadFileRequest) Descriptor() ([]byte, []int)
Deprecated: Use DownloadFileRequest.ProtoReflect.Descriptor instead.
func (*DownloadFileRequest) GetId ¶
func (x *DownloadFileRequest) GetId() int64
func (*DownloadFileRequest) ProtoMessage ¶
func (*DownloadFileRequest) ProtoMessage()
func (*DownloadFileRequest) ProtoReflect ¶
func (x *DownloadFileRequest) ProtoReflect() protoreflect.Message
func (*DownloadFileRequest) Reset ¶
func (x *DownloadFileRequest) Reset()
func (*DownloadFileRequest) String ¶
func (x *DownloadFileRequest) String() string
type FileInfo ¶
type FileInfo struct {
// 文件ID
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// 文件名
FileName string `protobuf:"bytes,2,opt,name=fileName,proto3" json:"fileName,omitempty"`
// 文件类型
FileType FileType `protobuf:"varint,3,opt,name=fileType,proto3,enum=filemanager.v1.FileType" json:"fileType,omitempty"`
// 文件大小(字节)
FileSize int64 `protobuf:"varint,4,opt,name=fileSize,proto3" json:"fileSize,omitempty"`
// 内容类型
ContentType string `protobuf:"bytes,5,opt,name=contentType,proto3" json:"contentType,omitempty"`
// 上传时间(ISO 8601格式)
UploadTime string `protobuf:"bytes,6,opt,name=uploadTime,proto3" json:"uploadTime,omitempty"`
// 文件描述
Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"`
// 文件路径
FilePath string `protobuf:"bytes,8,opt,name=filePath,proto3" json:"filePath,omitempty"`
// contains filtered or unexported fields
}
文件信息
func (*FileInfo) Descriptor
deprecated
func (*FileInfo) GetContentType ¶
func (*FileInfo) GetDescription ¶
func (*FileInfo) GetFileName ¶
func (*FileInfo) GetFilePath ¶
func (*FileInfo) GetFileSize ¶
func (*FileInfo) GetFileType ¶
func (*FileInfo) GetUploadTime ¶
func (*FileInfo) ProtoMessage ¶
func (*FileInfo) ProtoMessage()
func (*FileInfo) ProtoReflect ¶
func (x *FileInfo) ProtoReflect() protoreflect.Message
type FileManagerClient ¶
type FileManagerClient interface {
// 获取文件信息
GetFileInfo(ctx context.Context, in *GetFileInfoRequest, opts ...grpc.CallOption) (*GetFileInfoReply, error)
// 获取文件列表
ListFiles(ctx context.Context, in *ListFilesRequest, opts ...grpc.CallOption) (*ListFilesReply, error)
// 删除文件
DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*DeleteFileReply, error)
// 下载文件
DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (*DownloadFileReply, error)
}
FileManagerClient is the client API for FileManager 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 NewFileManagerClient ¶
func NewFileManagerClient(cc grpc.ClientConnInterface) FileManagerClient
type FileManagerServer ¶
type FileManagerServer interface {
// 获取文件信息
GetFileInfo(context.Context, *GetFileInfoRequest) (*GetFileInfoReply, error)
// 获取文件列表
ListFiles(context.Context, *ListFilesRequest) (*ListFilesReply, error)
// 删除文件
DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileReply, error)
// 下载文件
DownloadFile(context.Context, *DownloadFileRequest) (*DownloadFileReply, error)
// contains filtered or unexported methods
}
FileManagerServer is the server API for FileManager service. All implementations must embed UnimplementedFileManagerServer for forward compatibility
type FileType ¶
type FileType int32
文件类型枚举
func (FileType) Descriptor ¶
func (FileType) Descriptor() protoreflect.EnumDescriptor
func (FileType) EnumDescriptor
deprecated
func (FileType) Number ¶
func (x FileType) Number() protoreflect.EnumNumber
func (FileType) Type ¶
func (FileType) Type() protoreflect.EnumType
type GetFileInfoReply ¶
type GetFileInfoReply struct {
// 文件信息
FileInfo *FileInfo `protobuf:"bytes,1,opt,name=fileInfo,proto3" json:"fileInfo,omitempty"`
// contains filtered or unexported fields
}
获取文件信息响应
func (*GetFileInfoReply) Descriptor
deprecated
func (*GetFileInfoReply) Descriptor() ([]byte, []int)
Deprecated: Use GetFileInfoReply.ProtoReflect.Descriptor instead.
func (*GetFileInfoReply) GetFileInfo ¶
func (x *GetFileInfoReply) GetFileInfo() *FileInfo
func (*GetFileInfoReply) ProtoMessage ¶
func (*GetFileInfoReply) ProtoMessage()
func (*GetFileInfoReply) ProtoReflect ¶
func (x *GetFileInfoReply) ProtoReflect() protoreflect.Message
func (*GetFileInfoReply) Reset ¶
func (x *GetFileInfoReply) Reset()
func (*GetFileInfoReply) String ¶
func (x *GetFileInfoReply) String() string
type GetFileInfoRequest ¶
type GetFileInfoRequest struct {
// 文件ID
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
获取文件信息请求
func (*GetFileInfoRequest) Descriptor
deprecated
func (*GetFileInfoRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetFileInfoRequest.ProtoReflect.Descriptor instead.
func (*GetFileInfoRequest) GetId ¶
func (x *GetFileInfoRequest) GetId() int64
func (*GetFileInfoRequest) ProtoMessage ¶
func (*GetFileInfoRequest) ProtoMessage()
func (*GetFileInfoRequest) ProtoReflect ¶
func (x *GetFileInfoRequest) ProtoReflect() protoreflect.Message
func (*GetFileInfoRequest) Reset ¶
func (x *GetFileInfoRequest) Reset()
func (*GetFileInfoRequest) String ¶
func (x *GetFileInfoRequest) String() string
type ListFilesReply ¶
type ListFilesReply struct {
// 文件信息列表
Files []*FileInfo `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
// 总数
Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
// contains filtered or unexported fields
}
获取文件列表响应
func (*ListFilesReply) Descriptor
deprecated
func (*ListFilesReply) Descriptor() ([]byte, []int)
Deprecated: Use ListFilesReply.ProtoReflect.Descriptor instead.
func (*ListFilesReply) GetFiles ¶
func (x *ListFilesReply) GetFiles() []*FileInfo
func (*ListFilesReply) GetTotal ¶
func (x *ListFilesReply) GetTotal() int64
func (*ListFilesReply) ProtoMessage ¶
func (*ListFilesReply) ProtoMessage()
func (*ListFilesReply) ProtoReflect ¶
func (x *ListFilesReply) ProtoReflect() protoreflect.Message
func (*ListFilesReply) Reset ¶
func (x *ListFilesReply) Reset()
func (*ListFilesReply) String ¶
func (x *ListFilesReply) String() string
type ListFilesRequest ¶
type ListFilesRequest struct {
// 文件类型
FileType FileType `protobuf:"varint,1,opt,name=fileType,proto3,enum=filemanager.v1.FileType" json:"fileType,omitempty"`
// 分页限制
Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
// 分页偏移
Offset int32 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
// contains filtered or unexported fields
}
获取文件列表请求
func (*ListFilesRequest) Descriptor
deprecated
func (*ListFilesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListFilesRequest.ProtoReflect.Descriptor instead.
func (*ListFilesRequest) GetFileType ¶
func (x *ListFilesRequest) GetFileType() FileType
func (*ListFilesRequest) GetLimit ¶
func (x *ListFilesRequest) GetLimit() int32
func (*ListFilesRequest) GetOffset ¶
func (x *ListFilesRequest) GetOffset() int32
func (*ListFilesRequest) ProtoMessage ¶
func (*ListFilesRequest) ProtoMessage()
func (*ListFilesRequest) ProtoReflect ¶
func (x *ListFilesRequest) ProtoReflect() protoreflect.Message
func (*ListFilesRequest) Reset ¶
func (x *ListFilesRequest) Reset()
func (*ListFilesRequest) String ¶
func (x *ListFilesRequest) String() string
type UnimplementedFileManagerServer ¶
type UnimplementedFileManagerServer struct {
}
UnimplementedFileManagerServer must be embedded to have forward compatible implementations.
func (UnimplementedFileManagerServer) DeleteFile ¶
func (UnimplementedFileManagerServer) DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileReply, error)
func (UnimplementedFileManagerServer) DownloadFile ¶
func (UnimplementedFileManagerServer) DownloadFile(context.Context, *DownloadFileRequest) (*DownloadFileReply, error)
func (UnimplementedFileManagerServer) GetFileInfo ¶
func (UnimplementedFileManagerServer) GetFileInfo(context.Context, *GetFileInfoRequest) (*GetFileInfoReply, error)
func (UnimplementedFileManagerServer) ListFiles ¶
func (UnimplementedFileManagerServer) ListFiles(context.Context, *ListFilesRequest) (*ListFilesReply, error)
type UnsafeFileManagerServer ¶
type UnsafeFileManagerServer interface {
// contains filtered or unexported methods
}
UnsafeFileManagerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to FileManagerServer will result in compilation errors.