s3

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorReason_name = map[int32]string{
		0: "NOT_ALLOW_EXT",
		1: "CONFIG_NOT_FOUND",
	}
	ErrorReason_value = map[string]int32{
		"NOT_ALLOW_EXT":    0,
		"CONFIG_NOT_FOUND": 1,
	}
)

Enum value maps for ErrorReason.

View Source
var File_fs_s3_conf_proto protoreflect.FileDescriptor

Functions

func ErrorConfigNotFound added in v0.0.34

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

func ErrorNotAllowExt

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

为某个枚举单独设置错误码

func IsConfigNotFound added in v0.0.34

func IsConfigNotFound(err error) bool

func IsNotAllowExt

func IsNotAllowExt(err error) bool

为某个枚举单独设置错误码

Types

type Conf

type Conf struct {
	Key    string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Secret string `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"`
	Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"`
	Bucket string `protobuf:"bytes,4,opt,name=bucket,proto3" json:"bucket,omitempty"`
	Dir    string `protobuf:"bytes,5,opt,name=dir,proto3" json:"dir,omitempty"`
	// contains filtered or unexported fields
}

func (*Conf) Descriptor deprecated

func (*Conf) Descriptor() ([]byte, []int)

Deprecated: Use Conf.ProtoReflect.Descriptor instead.

func (*Conf) GetBucket

func (x *Conf) GetBucket() string

func (*Conf) GetDir added in v0.0.26

func (x *Conf) GetDir() string

func (*Conf) GetKey

func (x *Conf) GetKey() string

func (*Conf) GetRegion

func (x *Conf) GetRegion() string

func (*Conf) GetSecret

func (x *Conf) GetSecret() string

func (*Conf) ProtoMessage

func (*Conf) ProtoMessage()

func (*Conf) ProtoReflect

func (x *Conf) ProtoReflect() protoreflect.Message

func (*Conf) Reset

func (x *Conf) Reset()

func (*Conf) String

func (x *Conf) String() string

func (*Conf) Validate

func (m *Conf) Validate() error

Validate checks the field values on Conf 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 (*Conf) ValidateAll

func (m *Conf) ValidateAll() error

ValidateAll checks the field values on Conf 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 ConfMultiError, or nil if none found.

type ConfMultiError

type ConfMultiError []error

ConfMultiError is an error wrapping multiple validation errors returned by Conf.ValidateAll() if the designated constraints aren't met.

func (ConfMultiError) AllErrors

func (m ConfMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ConfMultiError) Error

func (m ConfMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ConfValidationError

type ConfValidationError struct {
	// contains filtered or unexported fields
}

ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.

func (ConfValidationError) Cause

func (e ConfValidationError) Cause() error

Cause function returns cause value.

func (ConfValidationError) Error

func (e ConfValidationError) Error() string

Error satisfies the builtin error interface

func (ConfValidationError) ErrorName

func (e ConfValidationError) ErrorName() string

ErrorName returns error name.

func (ConfValidationError) Field

func (e ConfValidationError) Field() string

Field function returns field value.

func (ConfValidationError) Key

func (e ConfValidationError) Key() bool

Key function returns key value.

func (ConfValidationError) Reason

func (e ConfValidationError) Reason() string

Reason function returns reason value.

type ErrorReason

type ErrorReason int32
const (
	// 为某个枚举单独设置错误码
	ErrorReason_NOT_ALLOW_EXT    ErrorReason = 0
	ErrorReason_CONFIG_NOT_FOUND ErrorReason = 1
)

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 S3Session

type S3Session struct {
	// contains filtered or unexported fields
}

func New

func New(c *Conf) (s3Sess *S3Session, err error)

func (*S3Session) AdminUploadResource

func (c *S3Session) AdminUploadResource(file multipart.File, fileHeader *multipart.FileHeader) (string, error)

func (*S3Session) ApiUploadAvatarDoc

func (c *S3Session) ApiUploadAvatarDoc(file multipart.File, fileHeader *multipart.FileHeader, dir string, userId, docId int64) (string, error)

func (*S3Session) CopyObject added in v0.0.30

func (c *S3Session) CopyObject(ctx context.Context, bucket, dir, filename string, src string) (string, error)

func (*S3Session) LazyMintUploadFile

func (c *S3Session) LazyMintUploadFile(ctx context.Context, file multipart.File, fileHeader *multipart.FileHeader) (string, error)

func (*S3Session) UploadBytes

func (c *S3Session) UploadBytes(ctx context.Context, fileName string, data []byte) (string, error)

func (*S3Session) UploadBytesToBucketDir added in v0.0.28

func (c *S3Session) UploadBytesToBucketDir(ctx context.Context, bucket, dir, fileName string, data []byte) (string, error)

func (*S3Session) UploadBytesToDir added in v0.0.26

func (c *S3Session) UploadBytesToDir(ctx context.Context, dir, fileName string, data []byte) (string, error)

func (*S3Session) UploadImage

func (c *S3Session) UploadImage(imagePath string, fileName string, proxy *url.URL) (string, error)

func (*S3Session) UploadMultipart

func (c *S3Session) UploadMultipart(fileHeader *multipart.FileHeader) (externalUrl string, err error)

Jump to

Keyboard shortcuts

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