Documentation ¶
Index ¶
- func ComputeHash(info os.FileInfo, path string, h hash.Hash) (interface{}, error)
- func DefaultFormatValue(attr, path string, info os.FileInfo) (value interface{}, err error)
- func FindHash(name string) func() hash.Hash
- func Format(p *FormatParams) (val interface{}, err error)
- func Parse(p *ParseParams) (val interface{}, err error)
- type ErrNotImplemented
- type ErrUnsupportedFormat
- type FormatParams
- type ParseParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeHash ¶
ComputeHash applies the hash h to the file located at path. Returns a line of dashes for directories.
func DefaultFormatValue ¶
DefaultFormatValue returns the default format value for the provided attribute attr based on path and info.
func Format ¶
func Format(p *FormatParams) (val interface{}, err error)
Format runs the respective format function on the provided parameters.
func Parse ¶
func Parse(p *ParseParams) (val interface{}, err error)
Parse runs the associated modifier function for the provided parameters. Depending on the type of p.Value, we may recursively run this method on every element of the structure.
We're using reflect _quite_ heavily for this, meaning it's kind of unsafe, it'd be great if we could find another solution while keeping it as abstract as it is.
Types ¶
type ErrNotImplemented ¶
ErrNotImplemented used for non-implemented modifier functions.
func (*ErrNotImplemented) Error ¶
func (e *ErrNotImplemented) Error() string
type ErrUnsupportedFormat ¶
ErrUnsupportedFormat used for unsupport arguments for FORMAT functions.
func (*ErrUnsupportedFormat) Error ¶
func (e *ErrUnsupportedFormat) Error() string
type FormatParams ¶
type FormatParams struct { Attribute string Path string Info os.FileInfo Value interface{} Name string Args []string }
FormatParams holds the params for a format-modifier function.
type ParseParams ¶
ParseParams holds the params for a parse-modifier function.