Package field provides tools for working with fields (i.e., something with a name and value pair), for the Go programming language.
- Go 100%
| impl | ||
| stringly | ||
| any.go | ||
| bool.go | ||
| bytes.go | ||
| complex.go | ||
| error.go | ||
| field.go | ||
| fieldany.go | ||
| fields.go | ||
| float.go | ||
| go.mod | ||
| go.sum | ||
| int.go | ||
| LICENSE | ||
| README.md | ||
| string.go | ||
| stringlyfield.go | ||
| test.go | ||
| time.go | ||
| uint.go | ||
| values.go | ||
go-field
Package field provides tools for working with fields (i.e., something with a name and value pair), for the Go programming-language (golang).
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-field
Examples
Here are some examples of fields being created.
import "codeberg.org/reiver/go-field"
// field.Field[string]
field1 := field.String("fruit", "cherry")
// field.Field[string]
field2 := field.Stringer("size", num)
// field.Field[error]
field3 := field.Error("err", err)
// field.Field[int]
field4 := field.Int("num", index)
// field.Field[time.Time]
field5 := field.Duration("delta", 5 * time.Minute)
Here is how one can get the name and value of a field:
name := field1.FieldName()
value := field1.FieldValue()
Here is how to turn any type of field into a field.Field[any]:
var fa field.Field[any] = field.FieldAny(field1)
Import
To import package field use import code like the following:
import "codeberg.org/reiver/go-field"
Installation
To install package field do the following:
GOPROXY=direct go get codeberg.org/reiver/go-field
Author
Package field was written by Charles Iliya Krempeaux