Package tmp implements an expiring optional-type with a time-out, for the Go programming language. In other programming languages, an optional-type might be known as: a option-type, or a maybe-type.
- Go 100%
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
| temporal.go | ||
| temporal_filter_test.go | ||
| temporal_get_test.go | ||
| temporal_gostring_test.go | ||
| temporal_is_defunct_test.go | ||
| temporal_is_nothing_test.go | ||
| temporal_marshaljson.go | ||
| temporal_marshaljson_bool_test.go | ||
| temporal_marshaljson_int_test.go | ||
| temporal_marshaljson_string_test.go | ||
| temporal_unmarshaljson.go | ||
| temporal_unmarshaljson_bool_test.go | ||
| temporal_unmarshaljson_string_test.go | ||
go-tmp
Package tmp implements an expiring optional-type with a time-out, for the Go programming language.
In other programming languages, an optional-type might be known as: a option-type, or a maybe-type.
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-tmp
Example
Here is a simple example:
import "codeberg.org/reiver/go-tmp"
// ...
var until time.Time = time.Now().Add(8 * time.Hour)
var temporal tmp.Temporal[string] = tmp.Temporary(value, until)
// ...
// If the temporal has expired then this will return the optional value 'nothing'.
// Else, it will return the optional value 'something' (containing the same internal value that was inside of the temporal).
optional := temporal.Optional()
val, found := optional.Get()
if found {
// ...
} else {
// ...
}
Import
To import package tmp use import code like the follownig:
import "codeberg.org/reiver/go-tmp"
Installation
To install package tmp do the following:
GOPROXY=direct go get codeberg.org/reiver/go-tmp
Author
Package tmp was written by Charles Iliya Krempeaux