storage

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 27 Imported by: 0

README

storage

Documentation

Index

Constants

View Source
const (
	PermPublic  = Perm("public")
	PermPrivate = Perm("private")
	PermTmp     = Perm("tmp")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GcpConf

type GcpConf struct {
	CredentialsFile string `yaml:"credentailsFile"`
	CredentailsUrl  string `yaml:"credentailsUrl"`
	Bucket          string `yaml:"bucket"`
}

func (*GcpConf) NewStorage

func (gcp *GcpConf) NewStorage(ctx context.Context) (GcpStorage, error)

type GcpConfigMap added in v1.1.0

type GcpConfigMap interface {
	GetConfig(key string) *GcpConf
}

func LoadGcpConfigMap added in v1.1.0

func LoadGcpConfigMap(file string) (GcpConfigMap, error)

type GcpDI

type GcpDI interface {
	NewStorage(ctx context.Context, bucket string) (GcpStorage, error)
}

type GcpStorage

type GcpStorage interface {
	Storage
	GetAttr(key string) (*googstorage.ObjectAttrs, error)
	GetDownloadUrl(key string) (myurl string, err error)
	Write(key string, writeData func(w io.Writer) error) (path string, err error)
	OpenFile(key string) (io.Reader, error)
	SignedURL(key string, contentType string, expDuration time.Duration) (url string, err error)
	GetAccessToken() (*oauth2.Token, error)
}

type GrpcGcpStorage added in v1.1.0

type GrpcGcpStorage interface {
	GcpStorage
	Close()
}

func NewGrpcGcpStorage added in v1.1.0

func NewGrpcGcpStorage(ctx context.Context, address string, channel string) (GrpcGcpStorage, error)

type Perm

type Perm string

type Storage

type Storage interface {
	Save(filePath string, file []byte) (string, error)
	SaveByReader(fp string, reader io.Reader) (string, error)
	Delete(filePath string) error
	Get(filePath string) ([]byte, error)
	FileExist(fp string) (bool, error)
	List(dir string) ([]string, error)
}

func NewHdStorage

func NewHdStorage(path string) Storage

Directories

Path Synopsis
_example
gcp
hd
grpc
pb

Jump to

Keyboard shortcuts

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