providers

package
v0.0.0-...-e7bb422 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeLocal = "local"
	TypeFTP   = "ftp"
)

Variables

View Source
var Plugin = plugins.Plugin{
	Config: &Config{},
	Inject: New,
}

Functions

func IsValidType

func IsValidType(s string) bool

func ParseFTP

func ParseFTP(uri string) (string, string, string, string, error)

Types

type Config

type Config struct {
	Items []Item `yaml:"store_providers"`
}

func (*Config) Default

func (v *Config) Default()

func (*Config) Validate

func (v *Config) Validate() error

type FTPProvider

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

func NewFTPProvider

func NewFTPProvider(ctx context.Context, c Item) *FTPProvider

func (*FTPProvider) Check

func (v *FTPProvider) Check() error

func (*FTPProvider) Code

func (v *FTPProvider) Code() string

func (*FTPProvider) DeleteFile

func (v *FTPProvider) DeleteFile(filename string) error

func (*FTPProvider) GetFile

func (v *FTPProvider) GetFile(filename string, ctx web.Context)

func (*FTPProvider) Name

func (v *FTPProvider) Name() string

func (*FTPProvider) SaveFile

func (v *FTPProvider) SaveFile(filename string, r io.ReadCloser) (string, error)

type Item

type Item struct {
	Name    string `yaml:"name"`
	Type    string `yaml:"type"`
	Code    string `yaml:"code"`
	Prefix  string `yaml:"prefix"`
	Setting string `yaml:"setting"`
}

type LocalProvider

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

func NewLocalProvider

func NewLocalProvider(ctx context.Context, c Item) *LocalProvider

func (*LocalProvider) Check

func (v *LocalProvider) Check() error

func (*LocalProvider) Code

func (v *LocalProvider) Code() string

func (*LocalProvider) DeleteFile

func (v *LocalProvider) DeleteFile(filename string) error

func (*LocalProvider) GetFile

func (v *LocalProvider) GetFile(filename string, ctx web.Context)

func (*LocalProvider) Name

func (v *LocalProvider) Name() string

func (*LocalProvider) SaveFile

func (v *LocalProvider) SaveFile(filename string, r io.ReadCloser) (string, error)

type Provider

type Provider interface {
	Name() string
	Code() string
	Check() error
	GetFile(filename string, ctx web.Context)
	SaveFile(filename string, r io.ReadCloser) (string, error)
	DeleteFile(filename string) error
}

type Providers

type Providers interface {
	GetByCode(c string) (Provider, error)
	ListCodes() []string
}

func New

func New(c *Config) (*providers, Providers)

Jump to

Keyboard shortcuts

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