Documentation
¶
Index ¶
- Constants
- Variables
- func ErrorBadRequest(format string, args ...interface{}) *errors.Error
- func ErrorRecordAlreadyExists(format string, args ...interface{}) *errors.Error
- func ErrorRecordNotFound(format string, args ...interface{}) *errors.Error
- func ErrorSystemError(format string, args ...interface{}) *errors.Error
- func IsBadRequest(err error) bool
- func IsRecordAlreadyExists(err error) bool
- func IsRecordNotFound(err error) bool
- func IsSystemError(err error) bool
- func RegisterFileServiceHTTPServer(s *http.Server, srv FileServiceHTTPServer)
- func RegisterFileServiceServer(s grpc.ServiceRegistrar, srv FileServiceServer)
- type ErrorReason
- func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
- func (x ErrorReason) Enum() *ErrorReason
- func (ErrorReason) EnumDescriptor() ([]byte, []int)deprecated
- func (x ErrorReason) Number() protoreflect.EnumNumber
- func (x ErrorReason) String() string
- func (ErrorReason) Type() protoreflect.EnumType
- type FileServiceClient
- type FileServiceHTTPClient
- type FileServiceHTTPClientImpl
- type FileServiceHTTPServer
- type FileServiceServer
- type OssStsTokenResponse
- func (*OssStsTokenResponse) Descriptor() ([]byte, []int)deprecated
- func (x *OssStsTokenResponse) GetAccessKey() string
- func (x *OssStsTokenResponse) GetAccessSecret() string
- func (x *OssStsTokenResponse) GetBucketName() string
- func (x *OssStsTokenResponse) GetEndPoint() string
- func (x *OssStsTokenResponse) GetExpiration() string
- func (x *OssStsTokenResponse) GetRegion() string
- func (x *OssStsTokenResponse) GetSecurityToken() string
- func (x *OssStsTokenResponse) GetUrl() string
- func (*OssStsTokenResponse) ProtoMessage()
- func (x *OssStsTokenResponse) ProtoReflect() protoreflect.Message
- func (x *OssStsTokenResponse) Reset()
- func (x *OssStsTokenResponse) String() string
- func (m *OssStsTokenResponse) Validate() error
- func (m *OssStsTokenResponse) ValidateAll() error
- type OssStsTokenResponseMultiError
- type OssStsTokenResponseValidationError
- func (e OssStsTokenResponseValidationError) Cause() error
- func (e OssStsTokenResponseValidationError) Error() string
- func (e OssStsTokenResponseValidationError) ErrorName() string
- func (e OssStsTokenResponseValidationError) Field() string
- func (e OssStsTokenResponseValidationError) Key() bool
- func (e OssStsTokenResponseValidationError) Reason() string
- type UnimplementedFileServiceServer
- type UnsafeFileServiceServer
- type UploadFileRequest
- func (*UploadFileRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UploadFileRequest) GetContent() []byte
- func (x *UploadFileRequest) GetFileName() string
- func (x *UploadFileRequest) GetFileType() string
- func (*UploadFileRequest) ProtoMessage()
- func (x *UploadFileRequest) ProtoReflect() protoreflect.Message
- func (x *UploadFileRequest) Reset()
- func (x *UploadFileRequest) String() string
- func (m *UploadFileRequest) Validate() error
- func (m *UploadFileRequest) ValidateAll() error
- type UploadFileRequestMultiError
- type UploadFileRequestValidationError
- func (e UploadFileRequestValidationError) Cause() error
- func (e UploadFileRequestValidationError) Error() string
- func (e UploadFileRequestValidationError) ErrorName() string
- func (e UploadFileRequestValidationError) Field() string
- func (e UploadFileRequestValidationError) Key() bool
- func (e UploadFileRequestValidationError) Reason() string
- type UploadFileResponse
- func (*UploadFileResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UploadFileResponse) GetUrl() string
- func (*UploadFileResponse) ProtoMessage()
- func (x *UploadFileResponse) ProtoReflect() protoreflect.Message
- func (x *UploadFileResponse) Reset()
- func (x *UploadFileResponse) String() string
- func (m *UploadFileResponse) Validate() error
- func (m *UploadFileResponse) ValidateAll() error
- type UploadFileResponseMultiError
- type UploadFileResponseValidationError
- func (e UploadFileResponseValidationError) Cause() error
- func (e UploadFileResponseValidationError) Error() string
- func (e UploadFileResponseValidationError) ErrorName() string
- func (e UploadFileResponseValidationError) Field() string
- func (e UploadFileResponseValidationError) Key() bool
- func (e UploadFileResponseValidationError) Reason() string
Constants ¶
const ( FileService_GetOssStsToken_FullMethodName = "/file.v1.FileService/GetOssStsToken" FileService_UploadFile_FullMethodName = "/file.v1.FileService/UploadFile" )
const OperationFileServiceGetOssStsToken = "/file.v1.FileService/GetOssStsToken"
const OperationFileServiceUploadFile = "/file.v1.FileService/UploadFile"
Variables ¶
var ( ErrorReason_name = map[int32]string{ 0: "RECORD_NOT_FOUND", 1: "RECORD_ALREADY_EXISTS", 2: "BAD_REQUEST", 3: "SYSTEM_ERROR", } ErrorReason_value = map[string]int32{ "RECORD_NOT_FOUND": 0, "RECORD_ALREADY_EXISTS": 1, "BAD_REQUEST": 2, "SYSTEM_ERROR": 3, } )
Enum value maps for ErrorReason.
var FileService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "file.v1.FileService", HandlerType: (*FileServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetOssStsToken", Handler: _FileService_GetOssStsToken_Handler, }, { MethodName: "UploadFile", Handler: _FileService_UploadFile_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "file/v1/file.proto", }
FileService_ServiceDesc is the grpc.ServiceDesc for FileService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_file_v1_error_reason_proto protoreflect.FileDescriptor
var File_file_v1_file_proto protoreflect.FileDescriptor
Functions ¶
func ErrorBadRequest ¶
func ErrorRecordNotFound ¶
func ErrorSystemError ¶
func IsBadRequest ¶
func IsRecordAlreadyExists ¶
func IsRecordNotFound ¶
func IsSystemError ¶
func RegisterFileServiceHTTPServer ¶
func RegisterFileServiceHTTPServer(s *http.Server, srv FileServiceHTTPServer)
func RegisterFileServiceServer ¶
func RegisterFileServiceServer(s grpc.ServiceRegistrar, srv FileServiceServer)
Types ¶
type ErrorReason ¶
type ErrorReason int32
const ( ErrorReason_RECORD_NOT_FOUND ErrorReason = 0 ErrorReason_RECORD_ALREADY_EXISTS ErrorReason = 1 ErrorReason_BAD_REQUEST ErrorReason = 2 ErrorReason_SYSTEM_ERROR ErrorReason = 3 )
func (ErrorReason) Descriptor ¶
func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
func (ErrorReason) Enum ¶
func (x ErrorReason) Enum() *ErrorReason
func (ErrorReason) EnumDescriptor
deprecated
func (ErrorReason) EnumDescriptor() ([]byte, []int)
Deprecated: Use ErrorReason.Descriptor instead.
func (ErrorReason) Number ¶
func (x ErrorReason) Number() protoreflect.EnumNumber
func (ErrorReason) String ¶
func (x ErrorReason) String() string
func (ErrorReason) Type ¶
func (ErrorReason) Type() protoreflect.EnumType
type FileServiceClient ¶
type FileServiceClient interface { // 获取ossToken GetOssStsToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*OssStsTokenResponse, error) // 文件上传 UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileResponse, error) }
FileServiceClient is the client API for FileService 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 NewFileServiceClient ¶
func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient
type FileServiceHTTPClient ¶
type FileServiceHTTPClient interface { GetOssStsToken(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *OssStsTokenResponse, err error) UploadFile(ctx context.Context, req *UploadFileRequest, opts ...http.CallOption) (rsp *UploadFileResponse, err error) }
func NewFileServiceHTTPClient ¶
func NewFileServiceHTTPClient(client *http.Client) FileServiceHTTPClient
type FileServiceHTTPClientImpl ¶
type FileServiceHTTPClientImpl struct {
// contains filtered or unexported fields
}
func (*FileServiceHTTPClientImpl) GetOssStsToken ¶
func (c *FileServiceHTTPClientImpl) GetOssStsToken(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*OssStsTokenResponse, error)
func (*FileServiceHTTPClientImpl) UploadFile ¶
func (c *FileServiceHTTPClientImpl) UploadFile(ctx context.Context, in *UploadFileRequest, opts ...http.CallOption) (*UploadFileResponse, error)
type FileServiceHTTPServer ¶
type FileServiceHTTPServer interface { GetOssStsToken(context.Context, *emptypb.Empty) (*OssStsTokenResponse, error) UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error) }
type FileServiceServer ¶
type FileServiceServer interface { // 获取ossToken GetOssStsToken(context.Context, *emptypb.Empty) (*OssStsTokenResponse, error) // 文件上传 UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error) // contains filtered or unexported methods }
FileServiceServer is the server API for FileService service. All implementations must embed UnimplementedFileServiceServer for forward compatibility
type OssStsTokenResponse ¶
type OssStsTokenResponse struct { // access_key AccessKey string `protobuf:"bytes,1,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` // access_secret AccessSecret string `protobuf:"bytes,2,opt,name=access_secret,json=accessSecret,proto3" json:"access_secret,omitempty"` // 过期时间 Expiration string `protobuf:"bytes,3,opt,name=expiration,proto3" json:"expiration,omitempty"` // 安全令牌 SecurityToken string `protobuf:"bytes,4,opt,name=security_token,json=securityToken,proto3" json:"security_token,omitempty"` // 终端 EndPoint string `protobuf:"bytes,5,opt,name=end_point,json=endPoint,proto3" json:"end_point,omitempty"` // 存储桶 BucketName string `protobuf:"bytes,6,opt,name=bucket_name,json=bucketName,proto3" json:"bucket_name,omitempty"` // 区域 Region string `protobuf:"bytes,7,opt,name=region,proto3" json:"region,omitempty"` // url Url string `protobuf:"bytes,8,opt,name=url,proto3" json:"url,omitempty"` // contains filtered or unexported fields }
响应 - OSS前端直传信息
func (*OssStsTokenResponse) Descriptor
deprecated
func (*OssStsTokenResponse) Descriptor() ([]byte, []int)
Deprecated: Use OssStsTokenResponse.ProtoReflect.Descriptor instead.
func (*OssStsTokenResponse) GetAccessKey ¶
func (x *OssStsTokenResponse) GetAccessKey() string
func (*OssStsTokenResponse) GetAccessSecret ¶
func (x *OssStsTokenResponse) GetAccessSecret() string
func (*OssStsTokenResponse) GetBucketName ¶
func (x *OssStsTokenResponse) GetBucketName() string
func (*OssStsTokenResponse) GetEndPoint ¶
func (x *OssStsTokenResponse) GetEndPoint() string
func (*OssStsTokenResponse) GetExpiration ¶
func (x *OssStsTokenResponse) GetExpiration() string
func (*OssStsTokenResponse) GetRegion ¶
func (x *OssStsTokenResponse) GetRegion() string
func (*OssStsTokenResponse) GetSecurityToken ¶
func (x *OssStsTokenResponse) GetSecurityToken() string
func (*OssStsTokenResponse) GetUrl ¶
func (x *OssStsTokenResponse) GetUrl() string
func (*OssStsTokenResponse) ProtoMessage ¶
func (*OssStsTokenResponse) ProtoMessage()
func (*OssStsTokenResponse) ProtoReflect ¶
func (x *OssStsTokenResponse) ProtoReflect() protoreflect.Message
func (*OssStsTokenResponse) Reset ¶
func (x *OssStsTokenResponse) Reset()
func (*OssStsTokenResponse) String ¶
func (x *OssStsTokenResponse) String() string
func (*OssStsTokenResponse) Validate ¶
func (m *OssStsTokenResponse) Validate() error
Validate checks the field values on OssStsTokenResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*OssStsTokenResponse) ValidateAll ¶
func (m *OssStsTokenResponse) ValidateAll() error
ValidateAll checks the field values on OssStsTokenResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in OssStsTokenResponseMultiError, or nil if none found.
type OssStsTokenResponseMultiError ¶
type OssStsTokenResponseMultiError []error
OssStsTokenResponseMultiError is an error wrapping multiple validation errors returned by OssStsTokenResponse.ValidateAll() if the designated constraints aren't met.
func (OssStsTokenResponseMultiError) AllErrors ¶
func (m OssStsTokenResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (OssStsTokenResponseMultiError) Error ¶
func (m OssStsTokenResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type OssStsTokenResponseValidationError ¶
type OssStsTokenResponseValidationError struct {
// contains filtered or unexported fields
}
OssStsTokenResponseValidationError is the validation error returned by OssStsTokenResponse.Validate if the designated constraints aren't met.
func (OssStsTokenResponseValidationError) Cause ¶
func (e OssStsTokenResponseValidationError) Cause() error
Cause function returns cause value.
func (OssStsTokenResponseValidationError) Error ¶
func (e OssStsTokenResponseValidationError) Error() string
Error satisfies the builtin error interface
func (OssStsTokenResponseValidationError) ErrorName ¶
func (e OssStsTokenResponseValidationError) ErrorName() string
ErrorName returns error name.
func (OssStsTokenResponseValidationError) Field ¶
func (e OssStsTokenResponseValidationError) Field() string
Field function returns field value.
func (OssStsTokenResponseValidationError) Key ¶
func (e OssStsTokenResponseValidationError) Key() bool
Key function returns key value.
func (OssStsTokenResponseValidationError) Reason ¶
func (e OssStsTokenResponseValidationError) Reason() string
Reason function returns reason value.
type UnimplementedFileServiceServer ¶
type UnimplementedFileServiceServer struct { }
UnimplementedFileServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedFileServiceServer) GetOssStsToken ¶
func (UnimplementedFileServiceServer) GetOssStsToken(context.Context, *emptypb.Empty) (*OssStsTokenResponse, error)
func (UnimplementedFileServiceServer) UploadFile ¶
func (UnimplementedFileServiceServer) UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error)
type UnsafeFileServiceServer ¶
type UnsafeFileServiceServer interface {
// contains filtered or unexported methods
}
UnsafeFileServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to FileServiceServer will result in compilation errors.
type UploadFileRequest ¶
type UploadFileRequest struct { FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` FileType string `protobuf:"bytes,2,opt,name=file_type,json=fileType,proto3" json:"file_type,omitempty"` Content []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
请求 - 文件上传
func (*UploadFileRequest) Descriptor
deprecated
func (*UploadFileRequest) Descriptor() ([]byte, []int)
Deprecated: Use UploadFileRequest.ProtoReflect.Descriptor instead.
func (*UploadFileRequest) GetContent ¶
func (x *UploadFileRequest) GetContent() []byte
func (*UploadFileRequest) GetFileName ¶
func (x *UploadFileRequest) GetFileName() string
func (*UploadFileRequest) GetFileType ¶
func (x *UploadFileRequest) GetFileType() string
func (*UploadFileRequest) ProtoMessage ¶
func (*UploadFileRequest) ProtoMessage()
func (*UploadFileRequest) ProtoReflect ¶
func (x *UploadFileRequest) ProtoReflect() protoreflect.Message
func (*UploadFileRequest) Reset ¶
func (x *UploadFileRequest) Reset()
func (*UploadFileRequest) String ¶
func (x *UploadFileRequest) String() string
func (*UploadFileRequest) Validate ¶
func (m *UploadFileRequest) Validate() error
Validate checks the field values on UploadFileRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*UploadFileRequest) ValidateAll ¶
func (m *UploadFileRequest) ValidateAll() error
ValidateAll checks the field values on UploadFileRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UploadFileRequestMultiError, or nil if none found.
type UploadFileRequestMultiError ¶
type UploadFileRequestMultiError []error
UploadFileRequestMultiError is an error wrapping multiple validation errors returned by UploadFileRequest.ValidateAll() if the designated constraints aren't met.
func (UploadFileRequestMultiError) AllErrors ¶
func (m UploadFileRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UploadFileRequestMultiError) Error ¶
func (m UploadFileRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UploadFileRequestValidationError ¶
type UploadFileRequestValidationError struct {
// contains filtered or unexported fields
}
UploadFileRequestValidationError is the validation error returned by UploadFileRequest.Validate if the designated constraints aren't met.
func (UploadFileRequestValidationError) Cause ¶
func (e UploadFileRequestValidationError) Cause() error
Cause function returns cause value.
func (UploadFileRequestValidationError) Error ¶
func (e UploadFileRequestValidationError) Error() string
Error satisfies the builtin error interface
func (UploadFileRequestValidationError) ErrorName ¶
func (e UploadFileRequestValidationError) ErrorName() string
ErrorName returns error name.
func (UploadFileRequestValidationError) Field ¶
func (e UploadFileRequestValidationError) Field() string
Field function returns field value.
func (UploadFileRequestValidationError) Key ¶
func (e UploadFileRequestValidationError) Key() bool
Key function returns key value.
func (UploadFileRequestValidationError) Reason ¶
func (e UploadFileRequestValidationError) Reason() string
Reason function returns reason value.
type UploadFileResponse ¶
type UploadFileResponse struct { Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` // contains filtered or unexported fields }
响应 - 文件上传url
func (*UploadFileResponse) Descriptor
deprecated
func (*UploadFileResponse) Descriptor() ([]byte, []int)
Deprecated: Use UploadFileResponse.ProtoReflect.Descriptor instead.
func (*UploadFileResponse) GetUrl ¶
func (x *UploadFileResponse) GetUrl() string
func (*UploadFileResponse) ProtoMessage ¶
func (*UploadFileResponse) ProtoMessage()
func (*UploadFileResponse) ProtoReflect ¶
func (x *UploadFileResponse) ProtoReflect() protoreflect.Message
func (*UploadFileResponse) Reset ¶
func (x *UploadFileResponse) Reset()
func (*UploadFileResponse) String ¶
func (x *UploadFileResponse) String() string
func (*UploadFileResponse) Validate ¶
func (m *UploadFileResponse) Validate() error
Validate checks the field values on UploadFileResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*UploadFileResponse) ValidateAll ¶
func (m *UploadFileResponse) ValidateAll() error
ValidateAll checks the field values on UploadFileResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UploadFileResponseMultiError, or nil if none found.
type UploadFileResponseMultiError ¶
type UploadFileResponseMultiError []error
UploadFileResponseMultiError is an error wrapping multiple validation errors returned by UploadFileResponse.ValidateAll() if the designated constraints aren't met.
func (UploadFileResponseMultiError) AllErrors ¶
func (m UploadFileResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UploadFileResponseMultiError) Error ¶
func (m UploadFileResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UploadFileResponseValidationError ¶
type UploadFileResponseValidationError struct {
// contains filtered or unexported fields
}
UploadFileResponseValidationError is the validation error returned by UploadFileResponse.Validate if the designated constraints aren't met.
func (UploadFileResponseValidationError) Cause ¶
func (e UploadFileResponseValidationError) Cause() error
Cause function returns cause value.
func (UploadFileResponseValidationError) Error ¶
func (e UploadFileResponseValidationError) Error() string
Error satisfies the builtin error interface
func (UploadFileResponseValidationError) ErrorName ¶
func (e UploadFileResponseValidationError) ErrorName() string
ErrorName returns error name.
func (UploadFileResponseValidationError) Field ¶
func (e UploadFileResponseValidationError) Field() string
Field function returns field value.
func (UploadFileResponseValidationError) Key ¶
func (e UploadFileResponseValidationError) Key() bool
Key function returns key value.
func (UploadFileResponseValidationError) Reason ¶
func (e UploadFileResponseValidationError) Reason() string
Reason function returns reason value.