Package field provides tools for working with fields (i.e., something with a name and value pair), for the Go programming language.
Find a file
2026-03-09 19:43:09 -07:00
impl stringly field 2026-03-09 19:32:49 -07:00
stringly stringer 2026-03-09 19:43:09 -07:00
any.go any 2025-11-11 01:04:02 -08:00
bool.go bool 2025-11-11 01:05:43 -08:00
bytes.go bytes 2025-11-11 01:06:57 -08:00
complex.go complex 2025-11-11 01:08:44 -08:00
error.go error 2025-11-11 01:09:53 -08:00
field.go stringly field 2026-03-09 19:32:49 -07:00
fieldany.go stringly field 2026-03-09 19:32:49 -07:00
fields.go stringly field 2026-03-09 19:32:49 -07:00
float.go float 2025-11-11 01:12:11 -08:00
go.mod stringly 2025-12-05 21:42:29 -08:00
go.sum stringly 2025-12-05 21:42:29 -08:00
int.go int 2025-11-11 01:13:57 -08:00
LICENSE initial commits 2025-11-10 05:14:28 -08:00
README.md docs 2026-03-09 16:59:51 -07:00
string.go F S 2026-03-09 19:38:38 -07:00
stringlyfield.go stringly field 2026-03-09 19:32:49 -07:00
test.go stringly field 2026-03-09 19:32:49 -07:00
time.go time 2025-11-11 01:16:58 -08:00
uint.go docs 2025-12-05 21:35:01 -08:00
values.go values 2025-11-11 01:19:31 -08:00

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

GoDoc

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