module
Version:
v1.0.1
Opens a new window with list of versions in this module.
Published: May 18, 2020
License: MIT
Opens a new window with license information.
README
¶
= Go Options
:source-highlighter: pygments
image:https://www.travis-ci.org/Foxcapades/goop.svg?branch=master["Build Status", link="https://www.travis-ci.org/Foxcapades/goop"]
image:https://img.shields.io/github/v/tag/Foxcapades/goop?label=version[caption="Latest Tag"]
image:https://goreportcard.com/badge/github.com/Foxcapades/goop[caption="Go Report Card", link="https://goreportcard.com/report/github.com/Foxcapades/goop"]
image:https://codecov.io/gh/Foxcapades/goop/branch/master/graph/badge.svg[caption="Coverage Report", link="https://codecov.io/gh/Foxcapades/goop"]
image:https://img.shields.io/github/license/Foxcapades/goop[GitHub]
Option types for Go's basic builtin types.
'''
.cmd/example/main.go
[source,go]
----
func main() {
fmt.Println(option.NewBool(true).
ForceMapToInt(func(b bool) int {
if b {
return 5
}
return 10
}).
ForceMapToString(strconv.Itoa).
ForceMapToUntyped(func(s string) interface{} { return NewTest(s) }).
MapToNillableString(func(t interface{}) *string { return nil }).
Or("15"))
}
----
Directories
¶
v1
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.