config

package
v0.0.0-...-e85674f Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigDir

func DefaultConfigDir(name string) (string, error)

DefaultConfigDir :

func DefaultJoinPath

func DefaultJoinPath(profile string, paths ...string) string

DefaultJoinPath :

func DefaultWriteFile

func DefaultWriteFile(path string) error

DefaultWriteFile :

func WithDefaultFunction

func WithDefaultFunction(writefile func(path string) error) func(*Config)

WithDefaultFunction :

func WithDirFunction

func WithDirFunction(dir func(name string) (string, error)) func(*Config)

WithDirFunction :

func WithMarshalUnmarshaller

func WithMarshalUnmarshaller(m MarshalUnmarshaller) func(*Config)

WithMarshalUnmarshaller :

func WithProfile

func WithProfile(profile string) func(*Config)

WithProfile :

Types

type Config

type Config struct {
	Name     string
	Profile  string // optional
	M        MarshalUnmarshaller
	JoinPath func(profile string, paths ...string) string
	Default  func(path string) error
	Dir      func(name string) (string, error)
}

Config :

func New

func New(name string, ops ...func(*Config)) *Config

New :

func (*Config) Load

func (c *Config) Load(name string, ob interface{}) error

Load :

func (*Config) Save

func (c *Config) Save(name string, ob interface{}) error

Save :

type JSONModule

type JSONModule struct {
}

JSONModule :

func (*JSONModule) Marshal

func (m *JSONModule) Marshal(w io.Writer, ob interface{}) error

Marshal :

func (*JSONModule) Unmarshal

func (m *JSONModule) Unmarshal(r io.Reader, ob interface{}) error

Unmarshal :

type MarshalUnmarshaller

type MarshalUnmarshaller interface {
	Marshaller
	Unmarshaller
}

MarshalUnmarshaller :

type Marshaller

type Marshaller interface {
	Marshal(w io.Writer, ob interface{}) error
}

Marshaller :

type Unmarshaller

type Unmarshaller interface {
	Unmarshal(r io.Reader, ob interface{}) error
}

Unmarshaller :

Jump to

Keyboard shortcuts

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