Documentation ¶
Index ¶
- func Boolean(value bool) *optionBoolean
- func Integer(value int) *optionInteger
- func ListString(value []string) *optionListString
- func String(value string) *optionString
- type Client
- func (c *Client) CommitChanges(ctx context.Context, config string) (bool, error)
- func (c *Client) CreateSection(ctx context.Context, config string, sectionType string, section string, ...) (bool, error)
- func (c *Client) DeleteSection(ctx context.Context, config string, section string) (bool, error)
- func (c *Client) GetSection(ctx context.Context, config string, section string) (Options, error)
- func (c *Client) ShowChanges(ctx context.Context, config string) ([][]string, error)
- func (c *Client) UpdateSection(ctx context.Context, config string, section string, options Options) (bool, error)
- type Option
- type OptionNotFoundError
- type OptionTypeMismatchError
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Boolean ¶ added in v0.0.6
func Boolean(value bool) *optionBoolean
Boolean constructs a new Option.
func Integer ¶ added in v0.0.6
func Integer(value int) *optionInteger
Integer constructs a new Option.
func ListString ¶ added in v0.0.6
func ListString(value []string) *optionListString
ListString constructs a new Option.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CommitChanges ¶ added in v0.0.2
func (*Client) CreateSection ¶ added in v0.0.2
func (*Client) DeleteSection ¶ added in v0.0.2
func (*Client) GetSection ¶
func (*Client) ShowChanges ¶ added in v0.0.2
type Option ¶ added in v0.0.6
type Option interface { json.Marshaler json.Unmarshaler AsBoolean() (bool, error) AsInteger() (int, error) AsListString() ([]string, error) AsString() (string, error) }
Option represents the different types of options that UCI supports. They can be parsed from/serialized to JSON using json.Unmarshal/json.Marshal, respectively. They can also attempt to be serialized to the underlying Go value using the `As*` methods.
To construct an Option, use one of Boolean, Integer, ListString, or String.
type OptionNotFoundError ¶ added in v0.0.6
type OptionNotFoundError struct {
// contains filtered or unexported fields
}
OptionNotFoundError represents an error finding the specified option. It also communicates which options were searched.
func NewOptionNotFoundError ¶ added in v0.0.6
func NewOptionNotFoundError( option string, options []string, ) OptionNotFoundError
NewOptionNotFoundError constructs a new OptionNotFoundError. The `option` should be the option that wasn't found. The `options` should be the options that were searched.
func (OptionNotFoundError) Equal ¶ added in v0.0.6
func (e OptionNotFoundError) Equal(other OptionNotFoundError) bool
func (OptionNotFoundError) Error ¶ added in v0.0.6
func (e OptionNotFoundError) Error() string
type OptionTypeMismatchError ¶ added in v0.0.6
type OptionTypeMismatchError struct {
// contains filtered or unexported fields
}
OptionTypeMismatchError represents an error where the option was not the expected type.
func NewOptionTypeMismatchError ¶ added in v0.0.6
func NewOptionTypeMismatchError( expected string, actual string, ) OptionTypeMismatchError
NewOptionTypeMismatchError constructs a new OptionTypeMismatchError. It requires both the `actual` and `expected` types.
func (OptionTypeMismatchError) Equal ¶ added in v0.0.6
func (e OptionTypeMismatchError) Equal(other OptionTypeMismatchError) bool
func (OptionTypeMismatchError) Error ¶ added in v0.0.6
func (e OptionTypeMismatchError) Error() string
type Options ¶ added in v0.0.6
Options are the actual UCI options for each section. The values can be booleans, integers, lists, and strings.
func (Options) GetBoolean ¶ added in v0.0.6
GetBoolean attempts to find the bool for the given option.
The error could either be NewOptionNotFoundError, or one of the standard JSON errors.
func (Options) GetInteger ¶ added in v0.0.6
GetInteger attempts to find the bool for the given option.
The error could either be NewOptionNotFoundError, or one of the standard JSON errors.
func (Options) GetListString ¶ added in v0.0.6
GetListString attempts to find the bool for the given option.
The error could either be NewOptionNotFoundError, or one of the standard JSON errors.
func (Options) GetString ¶ added in v0.0.6
GetString attempts to find the bool for the given option.
The error could either be NewOptionNotFoundError, or one of the standard JSON errors.