model

package
v0.0.0-...-16a29c9 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB() error

CloseDB closes the BoltDB database

func CreateBucket

func CreateBucket(bucket string) error

CreateBucket creates a new bucket if the bucket already exists do nothing

func DelBucketKey

func DelBucketKey(bucket, key string) error

DelBugetKey deletes a key/value pair in a bucket

func GetBucketValue

func GetBucketValue(bucket, key string, value interface{}) error

GetBucketValue gets a key/value pair in a bucket if the key does not exist, the value is set to nil takes bucket and key as strings, a value as pointer to interface{} and returns error

func GetBucketValues

func GetBucketValues(bucket string, values interface{}) error

GetBucketValues returns all values in a bucket

func NewDB

func NewDB() (err error)

NewDB creates and opens a BoltDB database at the given path If the file does not exist then it will be created automatically

func SetBucketValue

func SetBucketValue(bucket, key string, value interface{}) error

SetBucketValue sets a key/value pair in a bucket if the key already exists, the value is overwritten if the value is nil, the key is deleted

Types

type Item

type Item struct {
	Hash  string
	Name  string
	Path  string
	Size  int64
	IsDir bool

	UID        int
	GID        int
	CanBeRead  bool
	CanBeWrite bool

	Mode     os.FileMode
	ModTime  time.Time
	Children *Items
}

func ItemFromOs

func ItemFromOs(path string, child ...bool) (item Item, err error)

ItemFromOs returns an Item from an os.FileInfo. Use errors.Is to check the error type and handle it.

func (*Item) IsEmpty

func (item *Item) IsEmpty() bool

IsEmpty returns true if the item is empty.

func (*Item) IsReadable

func (item *Item) IsReadable() bool

IsReadable returns true if the item can be read.

func (*Item) IsWritable

func (item *Item) IsWritable() bool

IsWritable returns true if the item can be write.

type Items

type Items []Item

Jump to

Keyboard shortcuts

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