asset

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 7

Documentation

Overview

Package asset define asset testing utility

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(manager storage.Manager, URL string) error

Cleanup removes supplied locations

func Create

func Create(manager storage.Manager, URL string, resources []*Resource) error

Create creates supplied assets, links or folders in provided location (for testing purpose)

func Load

func Load(manager storage.Manager, URL string) (map[string]*Resource, error)

Load loads location resources for supplied manager

func Modify added in v1.2.0

func Modify(manager storage.Manager, URL string, resources []*Resource) error

Modify modify supplied assets, links or folders in provided location (for testing purpose)

Types

type Resource

type Resource struct {
	Dir      bool
	Link     string
	Name     string
	Mode     os.FileMode
	ModTime  *time.Time
	Data     []byte
	FileInfo os.FileInfo
}

Resource represents a test resource

func New

func New(name string, mode os.FileMode, dir bool, link string, data []byte) *Resource

New creates an asset

func NewDir

func NewDir(name string, mode os.FileMode) *Resource

NewDir create a folder resource

func NewFile

func NewFile(name string, data []byte, mode os.FileMode) *Resource

NewFile create a file resource

func NewGzFile added in v0.18.1

func NewGzFile(name string, data []byte, mode os.FileMode) *Resource

NewGzFile create a gz file resource

func NewLink(name, link string, mode os.FileMode) *Resource

NewLink create a link resource

func (Resource) Info

func (r Resource) Info() os.FileInfo

Info returns file info

func (*Resource) MergeFrom

func (r *Resource) MergeFrom(resource *Resource) error

MergeFrom merges into supplied resource

func (Resource) Reader

func (r Resource) Reader() io.Reader

Reader returns a reader

Jump to

Keyboard shortcuts

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