rclone: github.com/ncw/rclone/fs/config/configstruct Index | Files

package configstruct

import "github.com/ncw/rclone/fs/config/configstruct"

Package configstruct parses unstructured maps into structures

Index

Package Files

configstruct.go

func Set Uses

func Set(config configmap.Getter, opt interface{}) (err error)

Set interprets the field names in defaults and looks up config values in the config passed in. Any values found in config will be set in the opt structure.

opt must be a pointer to a struct. The struct should have entirely public fields. The field names are converted from CamelCase to snake_case and looked up in the config supplied or a `config:"field_name"` is looked up.

If items are found then they are converted from string to native types and set in opt.

All the field types in the struct must implement fmt.Scanner.

func StringToInterface Uses

func StringToInterface(def interface{}, in string) (newValue interface{}, err error)

StringToInterface turns in into an interface{} the same type as def

type Item Uses

type Item struct {
    Name  string // snake_case
    Field string // CamelCase
    Num   int    // number of the field in the struct
    Value interface{}
}

Item describes a single entry in the options structure

func Items Uses

func Items(opt interface{}) (items []Item, err error)

Items parses the opt struct and returns a slice of Item objects.

opt must be a pointer to a struct. The struct should have entirely public fields.

The config_name is looked up in a struct tag called "config" or if not found is the field name converted from CamelCase to snake_case.

Package configstruct imports 6 packages (graph) and is imported by 31 packages. Updated 2019-05-03. Refresh now. Tools for package owners.