yaml

package
v0.0.0-...-239b6c0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StoreDirectoryMode fs.FileMode = 0755
	StoreFileMode      fs.FileMode = 0644
)

Variables

This section is empty.

Functions

func NewDecoder

func NewDecoder(in io.Reader) *yaml.Decoder

func NewEncoder

func NewEncoder(out io.Writer) *yaml.Encoder

func WriteTo

func WriteTo(v interface{}, out io.Writer) (int64, error)

Types

type Decoder

type Decoder = yaml.Decoder

type Encoder

type Encoder = yaml.Encoder

type ExportDepth

type ExportDepth int
const (
	ExportShallow ExportDepth = iota
	ExportDeep
)

type Group

type Group struct {
	Id        types.Id
	Type      string  `yaml:",omitempty"`
	Name      string  `yaml:",omitempty"`
	Subgroups []Group `yaml:",omitempty"`
}

type Store

type Store struct {
	Basedir string
}

func (*Store) ExportNode

func (store *Store) ExportNode(w types.Node, depth ExportDepth) (g Group, err error)

Export Node data for YAML encoding

func (*Store) ExportNodes

func (store *Store) ExportNodes(w []types.Node, depth ExportDepth) ([]Group, error)

func (*Store) ExportSlice

func (store *Store) ExportSlice(data *types.Library, depth ExportDepth) yaml.MapSlice

Export Library for YAML encoding

func (*Store) ExportUser

func (store *Store) ExportUser(w *types.User, depth ExportDepth) (*User, error)

Export User data for YAML encoding

func (*Store) Load

func (store *Store) Load() (*types.Library, error)

func (*Store) ReadNodeFile

func (store *Store) ReadNodeFile(filename string) (types.Node, error)

func (*Store) ReadUserFile

func (store *Store) ReadUserFile(filename string) (*types.User, error)

func (*Store) Store

func (store *Store) Store(data *types.Library) error

func (*Store) WriteTo

func (store *Store) WriteTo(data *types.Library, out io.Writer) (int64, error)

Write all data into one file

type User

type User struct {
	Username string
	Name     string  `yaml:"-"`
	Avatar   string  `yaml:",omitempty"`
	Groups   []Group `yaml:",omitempty"`
}

Jump to

Keyboard shortcuts

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