attr

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 6 Imported by: 0

README

attr - A generic key-value attribute

Go Reference test codecov

Installation

go get github.com/m0t0k1ch1-go/attr

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr struct {
	// contains filtered or unexported fields
}

Attr represents a key-value pair.

func Bool

func Bool(k string, v bool) Attr

Bool returns a new Attr with the given key and bool value.

func Error added in v1.1.0

func Error(k string, v error) Attr

Error returns a new Attr with the given key and error value.

func Float64

func Float64(k string, v float64) Attr

Float64 returns a new Attr with the given key and float64 value.

func Int

func Int(k string, v int) Attr

Int returns a new Attr with the given key and int value.

func Int64

func Int64(k string, v int64) Attr

Int64 returns a new Attr with the given key and int64 value.

func SentryLevel added in v1.1.0

func SentryLevel(k string, v sentry.Level) Attr

SentryLevel returns a new Attr with the given key and sentry.Level value.

func String

func String(k string, v string) Attr

String returns a new Attr with the given key and string value.

func Uint64 added in v1.2.0

func Uint64(k string, v uint64) Attr

Uint64 returns a new Attr with the given key and uint64 value.

func (Attr) K

func (a Attr) K() string

K returns the key.

func (Attr) KV

func (a Attr) KV() (string, any)

KV returns the key and value.

func (Attr) SentryAttr

func (a Attr) SentryAttr() sentryattr.Builder

SentryAttr returns a sentry-go/attribute.Builder representation of the Attr.

func (Attr) SlogAttr

func (a Attr) SlogAttr() slog.Attr

SlogAttr returns a slog.Attr representation of the Attr.

func (Attr) String

func (a Attr) String() string

String implements fmt.Stringer. It returns the string representation of the Attr in the format "key=value".

func (Attr) V

func (a Attr) V() any

V returns the value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL