fields

package
v3.8.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(m1 map[string]interface{}, m2 map[string]interface{}) map[string]interface{}

Merge merges two instances of `map[string]interface{}`. You can pass here as arguments any types, which are in fact `map[string]interface{}`. If both maps has some key - the value from the `f2` will be used.

DEPRECATED: Use logan/v3 instead

func Obtain

func Obtain(entityName string, value interface{}) map[string]interface{}

Obtain tries to extract fields from `value`, if `value` implements Provider.

type Provider interface {
	GetLoganFields() map[string]interface{}
}

If `value` does not implement Provider - a map with 1 key and plain value will be returned.

DEPRECATED: Use logan/v3 instead

Types

type Provider

type Provider interface {
	GetLoganFields() map[string]interface{}
}

Provider if passed as a field value (see `logan.Entity.WithField()` and `errors.F.Add()`), will be transformed into map with multiple key-values: each key provided in the return map of implementation of `GetLoganFields()` will be prefixed with the key of the whole entity, using `_` delimiter. See example in tests.

DEPRECATED: Use logan/v3 instead

Jump to

Keyboard shortcuts

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