fields

package
v0.0.0-...-aac4589 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields map[string]interface{}

Fields is a multiple of fields which are attached to logger/tracer messages.

type PendingField

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

PendingField is a one entry of a history of added fields.

PendingField is focused on high-performance Clone method, for details see PendingFields.

type PendingFields

type PendingFields struct {
	Slice      Slice
	IsReadOnly bool
}

PendingFields is a history of added fields. It is focused on cheap cloning and adding new entries avoiding extra copy all the data on each adding of key-values. Therefore it is so-so performance-safe to use it for scoped contexts.

A resulting value could be received (compiled) on-need-basis using method Compile.

See also benchmark comments in pending_fields_test.go.

func (*PendingFields) AddMultiple

func (pendingFields *PendingFields) AddMultiple(fields Fields)

AddMultiple adds a set of fields.

func (*PendingFields) AddOne

func (pendingFields *PendingFields) AddOne(key string, value interface{})

AddOne adds one field.

func (PendingFields) Clone

func (pendingFields PendingFields) Clone() PendingFields

Clone returns a "copy" of PendingFields. It is safe to add new entries to this "copy" (it will not affect the original).

func (PendingFields) Compile

func (pendingFields PendingFields) Compile() Fields

Compile constructs Fields from PendingFields.

func (PendingFields) CompileWithStorage

func (pendingFields PendingFields) CompileWithStorage(m Fields) Fields

CompileWithStorage is the same as Compile, but allows to pass a storage to save values to. It could be used, for example, to reuse existing storages to reduce pressure on GC.

type Slice

type Slice []PendingField

Slice is a set of entries of a history of added fields.

See PendingFields.

Jump to

Keyboard shortcuts

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