A Value can represent any Go value, but unlike type any, it can represent most small values without an allocation. The zero Value corresponds to nil.

Hierarchy

  • Value

Methods

  • Any returns v's value as an any.

    Returns any

  • Bool returns v's value as a bool. It panics if v is not a bool.

    Returns boolean

  • Equal reports whether v and w represent the same Go value.

    Parameters

    Returns boolean

  • Float64 returns v's value as a float64. It panics if v is not a float64.

    Returns number

  • Group returns v's value as a []Attr. It panics if v's [Kind] is not [KindGroup].

    Returns Attr[]

  • Int64 returns v's value as an int64. It panics if v is not a signed integer.

    Returns number

  • Resolve repeatedly calls LogValue on v while it implements [LogValuer], and returns the result. If v resolves to a group, the group's attributes' values are not recursively resolved. If the number of LogValue calls exceeds a threshold, a Value containing an error is returned. Resolve's return value is guaranteed not to be of Kind [KindLogValuer].

    Returns Value

  • String returns Value's value as a string, formatted like [fmt.Sprint]. Unlike the methods Int64, Float64, and so on, which panic if v is of the wrong kind, String never panics.

    Returns string

  • Time returns v's value as a [time.Time]. It panics if v is not a time.Time.

    Returns Time

  • Uint64 returns v's value as a uint64. It panics if v is not an unsigned integer.

    Returns number

Generated using TypeDoc