fileloaders

package module
v0.0.1-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 7 Imported by: 8

README

fileloaders

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("does not supported")

Functions

func List

func List(ctx context.Context, path string, opt ...LoaderOption) ([]string, error)

func ListFile

func ListFile(ctx context.Context, path string) ([]string, error)

func Setup

func Setup(options ...Option)

Types

type File

type File struct {
	Type   string
	Bucket string
	Path   string
	// contains filtered or unexported fields
}

func Load

func Load(ctx context.Context, path string, opt ...LoaderOption) (*File, error)

func LoadFile

func LoadFile(ctx context.Context, path string) (*File, error)

func Parse

func Parse(path string) *File

func (*File) Add

func (f *File) Add(o ...FileOption) *File

func (*File) GetBody

func (f *File) GetBody() []byte

func (*File) Hash

func (f *File) Hash() (string, bool)

func (*File) Reader

func (f *File) Reader() io.ReadSeeker

func (*File) Unmarshal

func (f *File) Unmarshal(obj any) error

func (*File) Version

func (f *File) Version() (string, bool)

func (*File) Write

func (f *File) Write(p []byte) (n int, err error)

func (*File) WriteBody

func (f *File) WriteBody(p []byte) *File

type FileOption

type FileOption func(f *File)

func WithHash

func WithHash(hash *string) FileOption

func WithVersion

func WithVersion(version *string) FileOption

type ListFunc

type ListFunc func(ctx context.Context, path string) ([]string, error)

type Loader

type Loader interface {
	Load(ctx context.Context, path string, opt ...LoaderOption) (*File, error)
	List(ctx context.Context, path string, opt ...LoaderOption) ([]string, error)
}

type LoaderFunc

type LoaderFunc func(ctx context.Context, path string) (*File, error)

type LoaderOption

type LoaderOption func(loader Loader)

type MapLoader

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

func New

func New(options ...Option) *MapLoader

func (*MapLoader) List

func (m *MapLoader) List(ctx context.Context, path string, opt ...LoaderOption) ([]string, error)

func (*MapLoader) Load

func (m *MapLoader) Load(ctx context.Context, path string, opt ...LoaderOption) (*File, error)

type Option

type Option func(m map[string]Loader)

Directories

Path Synopsis
gs module
gs-loader module
http module
http-loader module
s3 module
s3-loader module
ssm-loader module

Jump to

Keyboard shortcuts

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