defaults

package
v0.0.0-...-367c84d Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2016 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(val interface{}) error

Apply apply the defaults values defined in the field tags. Currently the supported types are int, int32, int64, float32, float64, string, bool If the value is different of one these types the function returns an error.

The function expects a pointer to a struct.

Eg.

type testStruct struct {
     AString      string  `default:"Claudemiro"`
     AInt         int     `default:"27"`
     AInt32       int32   `default:"28"`
     AInt64       int64   `default:"29"`
     AFloat32     float32 `default:"3.1415"`
     AFloat64     float64 `default:"3.1415"`
     ABoolean     bool    `default:"true"`
     NotAnnotated float64
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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