mask

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Full       mtype = "full"
	Email      mtype = "email"
	Mobile     mtype = "mobile"
	CreditCard mtype = "credit"
	MStruct    mtype = "struct"
)

Variables

This section is empty.

Functions

func Struct

func Struct(s any) (output any)

Struct returns a copy of struct with masked fields. Fields can be marked for masking like this:

type Request struct {
	Password      string `mask:"full"`
	Email         string `mask:"email"`
	Mobile        string `mask:"mobile"`
	CreditCard    string `mask:"credit"`
	SomeStruct    T      `mask:"struct"`
}

If unable to mask any field - returns MaskFail struct with error description field. Meant to be used only for logging/tracing purposes!

Types

type MaskFail

type MaskFail struct {
	Error string
}

Jump to

Keyboard shortcuts

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