example

package
v0.0.0-...-7dbde00 Latest Latest
Warning

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

Go to latest
Published: May 31, 2016 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Age

func Age(o int) optPerson

Age sets a value for instances of type Person.

func FSlice

func FSlice(o []float64) optExample

FSlice sets a value for instances of type Example.

func Ff

func Ff(o func(int) int) optExample

Ff sets a value for instances of type Example.

func Map

func Map(o map[string]int) optExample

Map sets a value for instances of type Example.

func N

func N(o int) optExample

N sets a value for instances of type Example.

func Name

func Name(o string) optPerson

Name sets a value for instances of type Person.

Types

type Example

type Example struct {
	N      int
	FSlice []float64 `json:"float_slice"`
	Map    map[string]int
	Name   string `opt:"-" json:"name"`
	// contains filtered or unexported fields
}

Example is the struct that will hold optional values.

func NewExample

func NewExample(name string, options ...optExample) *Example

NewExample creates an example. name is required.

func (*Example) Option

func (t *Example) Option(options ...optExample) (previous optExample)

Option method sets the options. Returns previous option for last arg.

type Person

type Person struct {
	Name string
	Age  int
	// contains filtered or unexported fields
}

Person is a human.

func NewPerson

func NewPerson(ssn string, options ...optPerson) *Person

NewExample creates an example. name is required.

func (*Person) Option

func (t *Person) Option(options ...optPerson) (previous optPerson)

Option method sets the options. Returns previous option for last arg.

Jump to

Keyboard shortcuts

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