hexamask

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaskMapPaths

func MaskMapPaths(m hexa.Map, mask *FieldMask, depth int)

MaskMapPaths mask all paths in the provided map with the provided depth.

Types

type FieldMask

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

FieldMask mask keep list of masked paths of a struct|map|... and then you can check whether a path|struct field is masked or not. Use it to detect which fields provided by a user in a PATCH request. Note: you can specify mask path of each field of a struct by set the "mask" tag, otherwise it check the "json" tag.

func (*FieldMask) IsMasked

func (fm *FieldMask) IsMasked(i any) bool

IsMasked gets a struct field and specifies whether that field is masked or not. before call to this method you must call to the Mask() method to mask a struct. Note: provided value must be pointer to the value. even if the field is a pointer, you must provide pointer to that pointer field.

func (*FieldMask) MarshalJSON

func (fm *FieldMask) MarshalJSON() ([]byte, error)

func (*FieldMask) Mask

func (fm *FieldMask) Mask(s any)

Mask masks a struct's fields and then you can check to detect whether a field of that struct is masked or not. Note: provided value must be pointer to a struct.

func (*FieldMask) PathIsMasked

func (fm *FieldMask) PathIsMasked(path string) bool

PathIsMasked tel you whether the provided path is masked or not.

func (*FieldMask) SetPaths

func (fm *FieldMask) SetPaths(paths []string)

SetPaths sets the masked paths

func (*FieldMask) String

func (fm *FieldMask) String() string

String returns joined paths which divided by "," rune.

func (*FieldMask) UnmarshalJSON

func (fm *FieldMask) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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