v1

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileService_GetOssStsToken_FullMethodName = "/file.v1.FileService/GetOssStsToken"
	FileService_UploadFile_FullMethodName     = "/file.v1.FileService/UploadFile"
)
View Source
const OperationFileServiceGetOssStsToken = "/file.v1.FileService/GetOssStsToken"
View Source
const OperationFileServiceUploadFile = "/file.v1.FileService/UploadFile"

Variables

View Source
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.

View Source
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)

View Source
var File_file_v1_error_reason_proto protoreflect.FileDescriptor
View Source
var File_file_v1_file_proto protoreflect.FileDescriptor

Functions

func ErrorBadRequest

func ErrorBadRequest(format string, args ...interface{}) *errors.Error

func ErrorRecordAlreadyExists

func ErrorRecordAlreadyExists(format string, args ...interface{}) *errors.Error

func ErrorRecordNotFound

func ErrorRecordNotFound(format string, args ...interface{}) *errors.Error

func ErrorSystemError

func ErrorSystemError(format string, args ...interface{}) *errors.Error

func IsBadRequest

func IsBadRequest(err error) bool

func IsRecordAlreadyExists

func IsRecordAlreadyExists(err error) bool

func IsRecordNotFound

func IsRecordNotFound(err error) bool

func IsSystemError

func IsSystemError(err error) bool

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) 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

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.

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 (*FileServiceHTTPClientImpl) UploadFile

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

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

Cause function returns cause value.

func (OssStsTokenResponseValidationError) Error

Error satisfies the builtin error interface

func (OssStsTokenResponseValidationError) ErrorName

ErrorName returns error name.

func (OssStsTokenResponseValidationError) Field

Field function returns field value.

func (OssStsTokenResponseValidationError) Key

Key function returns key value.

func (OssStsTokenResponseValidationError) Reason

Reason function returns reason value.

type UnimplementedFileServiceServer

type UnimplementedFileServiceServer struct {
}

UnimplementedFileServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedFileServiceServer) GetOssStsToken

func (UnimplementedFileServiceServer) UploadFile

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

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

Cause function returns cause value.

func (UploadFileRequestValidationError) Error

Error satisfies the builtin error interface

func (UploadFileRequestValidationError) ErrorName

ErrorName returns error name.

func (UploadFileRequestValidationError) Field

Field function returns field value.

func (UploadFileRequestValidationError) Key

Key function returns key value.

func (UploadFileRequestValidationError) Reason

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

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

Cause function returns cause value.

func (UploadFileResponseValidationError) Error

Error satisfies the builtin error interface

func (UploadFileResponseValidationError) ErrorName

ErrorName returns error name.

func (UploadFileResponseValidationError) Field

Field function returns field value.

func (UploadFileResponseValidationError) Key

Key function returns key value.

func (UploadFileResponseValidationError) Reason

Reason function returns reason value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL