storage

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 21 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"`
}

func (*GcpConf) NewStorage

func (gcp *GcpConf) NewStorage(ctx context.Context, bucket string) (GcpStorage, 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)
	OpenFile(key string) (io.Reader, error)
	SignedURL(key string, contentType string, expDuration time.Duration) (url string, err error)
	GetAccessToken() (*oauth2.Token, 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 command
hd command

Jump to

Keyboard shortcuts

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