item

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	os.FileInfo
	FullPath string
	Meta     *cached.Map[string, Item]
	Cache    map[string][]byte
}

func NewFileInfo

func NewFileInfo(name string) (*FileInfo, error)

func NewFileInfoWithOption

func NewFileInfoWithOption(opts ...Option) (*FileInfo, error)

func (*FileInfo) Del

func (i *FileInfo) Del(key string)

Del delete content by key

func (*FileInfo) Get

func (i *FileInfo) Get(key string) (Item, bool)

Get content by key

func (*FileInfo) Keys

func (i *FileInfo) Keys() []string

Keys return all keys in random order

func (*FileInfo) KeysByOrder

func (i *FileInfo) KeysByOrder() []string

KeysByOrder return Keys(ordered by No, ascending)

func (*FileInfo) OrderedContent

func (i *FileInfo) OrderedContent(delimiter string) string

func (*FileInfo) Set

func (i *FileInfo) Set(key string, ic Item)

Set content by key

func (*FileInfo) Values

func (i *FileInfo) Values() []Item

func (*FileInfo) ValuesByOrdered

func (i *FileInfo) ValuesByOrdered() []Item

ValuesByOrdered return all content (ordered by No, ascending)

type Item

type Item interface {
	String() string
	NO() int // NO return the No. of item
	SetPrefix(string)
	SetSuffix(string)
	AddPrefix(string)
	AddSuffix(string)
}

type Option

type Option = func(info *FileInfo) error

func WithAbsPath

func WithAbsPath(path string) Option

func WithFileInfo

func WithFileInfo(info os.FileInfo) Option

func WithPath

func WithPath(path string) Option

WithPath will get the abs path of given string and set the full path of FileInfo

func WithSize

func WithSize(size int) Option

Jump to

Keyboard shortcuts

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