ini

package
v0.0.0-...-e53f896 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EOF = fmt.Errorf("END OF FILE")
	EOL = fmt.Errorf("END OF LINE")
)

Functions

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal encode interface v into INI-format

func Unmarshal

func Unmarshal(d []byte, v interface{}) error

Unmarshal decodes byte-array/slice containing INI into interface v

Types

type Date

type Date struct {
	time.Time
}

Date is equalient to time.Time but with custom Marshaler-interface to store only the date

func (*Date) MarshalINI

func (i *Date) MarshalINI() ([]byte, error)

MarshalINI will marshal the time into a string of format y-d-m-timezone-offset

func (*Date) UnmarshalINI

func (i *Date) UnmarshalINI(b []byte) error

UnmarshalINI will unmarshal a string formatted as y-m-d-timezone-offset

type INIDecoderError

type INIDecoderError struct {
	// contains filtered or unexported fields
}

INIDecoderError is returned on decoding error

func (*INIDecoderError) Error

func (i *INIDecoderError) Error() string

Error returns an formatted string of the INIDecoderError

type INIEncoderError

type INIEncoderError struct {
	// contains filtered or unexported fields
}

INIEncoderError is returned on encoding error

func (*INIEncoderError) Error

func (i *INIEncoderError) Error() string

Error returns an formatted string of the INIEncoderError

type IP

type IP struct {
	net.IP
}

IP is equalient to net.IP but with custom Marshaler-interface

func (*IP) MarshalINI

func (i *IP) MarshalINI() ([]byte, error)

MarshalINI will marshal the IP into IPv4 or IPv6 readable format, e.g 127.0.0.1 or ::

func (*IP) UnmarshalINI

func (i *IP) UnmarshalINI(b []byte) error

UnmarshalINI will unmarshal the value produced by MarshalINI, e.g 127.0.0.1 or :: into a net.IP

type Marshaler

type Marshaler interface {
	MarshalINI() ([]byte, error)
}

Marshaler is an interface to implement for unknown types

type SyntaxError

type SyntaxError struct {
	// contains filtered or unexported fields
}

SyntaxError is returned when the formatting is wrong.

func (SyntaxError) Error

func (s SyntaxError) Error() string

Error returns the error as a string

type Time

type Time struct {
	time.Time
}

Time is equalient to time.Time but with custom Marshaler-interface

func (*Time) MarshalINI

func (i *Time) MarshalINI() ([]byte, error)

MarshalINI will marshal the time into RFC822

func (*Time) UnmarshalINI

func (i *Time) UnmarshalINI(b []byte) error

UnmarshalINI will unmarshal the time from RFC822

type Unmarshaler

type Unmarshaler interface {
	UnmarshalINI([]byte) error
}

Unmarshaler is an interface to implement for unknown types

Jump to

Keyboard shortcuts

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