added docs

master
Charles Iliya Krempeaux 2017-05-18 11:56:21 -07:00
parent 266d3f6da4
commit 40c8fd548d
1 changed files with 36 additions and 0 deletions

36
doc.go
View File

@ -2,6 +2,42 @@
Package opt has a number of sub-packages provides alternatives to Go's built-in types (bool, float64, int64, string, time.Time) Package opt has a number of sub-packages provides alternatives to Go's built-in types (bool, float64, int64, string, time.Time)
that also let you express a "lack of a value"; for the Go programming language; these are similar to "option types" or "maybe types" that also let you express a "lack of a value"; for the Go programming language; these are similar to "option types" or "maybe types"
in some other programming languages. in some other programming languages.
Example:
var s optstring.NullableType
// ...
switch s {
case optstring.NoneNullable():
//@TODO
case optstring.Null():
//@TODO
case optstring.SomeNullable("Hello world!"):
//@TODO
case optstring.SomeNullable("apple banana cherry"):
//@TODO
default:
//@TODO
}
Example:
var s optstring.Type
// ...
switch s {
case optstring.None():
//@TODO
case optstring.Some("Hello world!"):
//@TODO
case optstring.Some("apple banana cherry"):
//@TODO
default:
//@TODO
}
*/ */
package opt package opt