private

package
v0.0.0-...-7b48451 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package private implements field redaction in maps and structs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redact

func Redact[T any](val T, tag string) (redacted T, err error)

Redact returns a copy of val with any fields or map elements that have been marked as private removed. Fields can be marked as private by including a sibling string- or []string-valued field or element with the name of the private field. The names of fields are interpreted through the tag parameter if present. For example if tag is "json", the `json:"<name>"` name would be used, falling back to the field name if not present. The tag parameter is ignored for map values.

If a field has a `private:...` tag, its tag value will also be used to determine the list of private fields. If the private tag is empty, `private:""`, the fields with the tag will be marked as private. Otherwise the comma-separated list of names with be used. The list may refer to its own field.

Types

This section is empty.

Jump to

Keyboard shortcuts

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