store

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 14 Imported by: 4

README

file

chefgo file module

Documentation

Index

Constants

View Source
const (
	NAME = "STORE"
)

Variables

This section is empty.

Functions

func Browse added in v0.0.2

func Browse(code string, query Map, expires ...time.Duration) (string, error)

func Configure

func Configure(cfg Map)

Configure 更新配置

func Download

func Download(code string) (string, error)

func Go

func Go()

Go 直接开跑 此方法只单独使用模块时用

func Preview

func Preview(code string, width, height, second int64) (string, error)

func PreviewConfig

func PreviewConfig() string

func Ready

func Ready()

Ready 准备运行 此方法只单独使用模块时用

func Register

func Register(name string, value Any, overrides ...bool)

Register 开放给外

func Remove

func Remove(code string) error

func SaltConfig added in v0.0.2

func SaltConfig() string

func StatFile

func StatFile(file string) (Map, error)

func Thumbnail

func Thumbnail(code string, width, height, pos int64) (string, error)

func ThumbnailConfig

func ThumbnailConfig() string

func Upload

func Upload(from Any, metadatas ...Map) (File, Files, error)

func UploadTo

func UploadTo(base string, from Any, metadatas ...Map) (File, Files, error)

Types

type Config

type Config struct {
	Driver  string
	Weight  int
	Proxy   bool
	Remote  bool
	Setting Map
}

type Configs

type Configs map[string]Config

type Connect

type Connect interface {
	Open() error
	Health() Health
	Close() error

	Upload(path string, metadata Map) (File, Files, error)
	Download(file File) (string, error)
	Browse(file File, query Map, expires time.Duration) (string, error)
	Remove(file File) error
}

Connect

type Driver

type Driver interface {
	Connect(*Instance) (Connect, error)
}

Driver

type File

type File interface {
	Base() string
	Hash() string
	Type() string
	Size() int64

	File() string
	Name() string
	Code() string

	Proxy() bool
	Remote() bool
}

func Decode

func Decode(code string) (File, error)

type Files

type Files []File

type Health

type Health struct {
	Workload int64
}

Health

type Info

type Info struct {
	Type string
	File string
}

type Instance

type Instance struct {
	Name    string
	Config  Config
	Setting Map
	// contains filtered or unexported fields
}

func (*Instance) Download added in v0.0.2

func (this *Instance) Download(file File) (string, error)

统一返回本地缓存目录

func (*Instance) File

func (this *Instance) File(hash string, file string, size int64) File

func (*Instance) Hash

func (this *Instance) Hash(file string) string

type Module

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

func (*Module) Browse added in v0.0.2

func (this *Module) Browse(code string, query Map, expires ...time.Duration) (string, error)

func (*Module) Config

func (this *Module) Config(name string, config Config, override bool)

func (*Module) Configs

func (this *Module) Configs(config Configs, override bool)

func (*Module) Configure

func (this *Module) Configure(global Map)

func (*Module) Connect

func (this *Module) Connect()

func (*Module) Download

func (this *Module) Download(code string) (string, error)

func (*Module) Driver

func (module *Module) Driver(name string, driver Driver, override bool)

func (*Module) Initialize

func (this *Module) Initialize()

func (*Module) Launch

func (this *Module) Launch()

func (*Module) Preview

func (this *Module) Preview(code string, width, height, position int64) (string, error)

Preview 生成缩略图

func (*Module) Previewer

func (this *Module) Previewer(name string, config Previewer, override bool)

func (*Module) Register

func (this *Module) Register(name string, value Any, override bool)

func (*Module) Remove

func (this *Module) Remove(code string) error

func (*Module) Terminate

func (this *Module) Terminate()

func (*Module) Thumbnail

func (this *Module) Thumbnail(code string, width, height, position int64) (string, error)

Thumbnail 生成缩略图

func (*Module) Thumbnailer

func (this *Module) Thumbnailer(name string, config Thumbnailer, override bool)

func (*Module) Upload

func (this *Module) Upload(path string, metadata Map) (File, Files, error)

func (*Module) UploadTo

func (this *Module) UploadTo(base string, path string, metadata Map) (File, Files, error)

type Previewer

type Previewer struct {
	// Name 名称
	Name string
	// Text 说明
	Text string
	// Alias 别名
	Alias []string
	// Preview 预览动图
	Action PreviewerFunc
}

type PreviewerFunc

type PreviewerFunc func(File, int64, int64, int64) (string, error)

type ThumbnailFunc

type ThumbnailFunc func(File, int64, int64, int64) (string, error)

type Thumbnailer

type Thumbnailer struct {
	// Name 名称
	Name string
	// Text 说明
	Text string
	// Alias 别名
	Alias []string
	// Thumbnail 缩图
	Action ThumbnailFunc
}

Jump to

Keyboard shortcuts

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