Documentation ¶
Index ¶
- func File(flag string, result interface{}) (error, string)
- func JSON(flag string, flagName string, targetDataType string, result interface{}) (error, string)
- func List(flag string, flagName string, targetDataType string, result interface{}) (err error, msg string)
- func Model(flag string, flagName string, modelName string, ...) (error, string)
- func ModelSlice(flag string, flagName string, modelName string, ...) (error, string)
- func SingleValue(flag string, flagName string, targetDataType string, result interface{}) (err error, msg string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func File ¶
Read the contents of a file into the target variable. The type of the target variable should be `io.ReadCloser` and the user-provided value should be a path to a valid file.
func JSON ¶
Deserialize a JSON string value into the target variable. JSON can also be provided through a file if the string starts with '@'. The string is assumed to be valid JSON.
func List ¶
func List(flag string, flagName string, targetDataType string, result interface{}) (err error, msg string)
Deserialize a list of values into the target variable. If the value provided by the user is not already a valid JSON array for the given type, convert it to the proper format before unmarshalling.
func Model ¶
func Model(flag string, flagName string, modelName string, unmarshalFunc core.ModelUnmarshaller, result interface{}) (error, string)
Deserialize a JSON object string value into the target variable, the type of which is a struct representing a model.
func ModelSlice ¶
func ModelSlice(flag string, flagName string, modelName string, unmarshalFunc core.ModelUnmarshaller, result interface{}) (error, string)
Deserialize a JSON array string value into the target variable, the type of which is a struct slice representing a list of models.
func SingleValue ¶
func SingleValue(flag string, flagName string, targetDataType string, result interface{}) (err error, msg string)
Deserialize a single value into the target variable. This is most often used for types like Date and DateTime. If the value provided by the user is not already valid JSON, wrap it in double quotes before unmarshalling.
Types ¶
This section is empty.