ffs

package
v0.0.0-...-a62e1d4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotConvert = errors.New("cannot convert to Node")
View Source
var ErrSplatNode = errors.New("cannot splat non-DirNode")

Functions

func ToNode

func ToNode(v any, p *Params) (np.Node, error)

ToNode creates a np.Node from a value.

The following conversions are available.

string -> file containing the string
[]byte -> file containing the data
[]T    -> directory of nodes converted from T
          if the a child node does not return a name, the array index is used
struct -> directory of fields tagged with `np:"name,opts"`
          available options are:
            write    - the node represented by this field should be writable
            exec    - the node represented by this field should be executable
            splat   - applied to a Dir Node, adds the children of the Dir to the struct
            omitnil - don't list the node if it's nil

          The following options mark fields to be used for Stat()
            stat  - Stat starts wth this value
            qid   - used as value for Stat.Qid
            name  - used as value for Stat.Name
            len   - used as value for Stat.Len
            typ   - used as value for Stat.Typ
            dev   - used as value for Stat.Dev
            ver   - used as value for Stat.Qid.Version
            atime - used as value for Stat.Atime
            mtime - used as value for Stat.Mtime
            uid   - used as value for Stat.Uid
            gid   - used as value for Stat.Gid
            muid  - used as value for Stat.Muid

Types

type Params

type Params struct {
	Name string
	Mode np.Mode
	Typ  uint16
	Dev  uint32
}

Params are default values that are used if a value does not implement Stat.

Jump to

Keyboard shortcuts

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