sanitiser

package module
v0.0.0-...-bb67ead Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2014 License: ISC Imports: 2 Imported by: 0

README

Sanitiser

This package provides contextual scrubbing of data based on tags.

Usage

type User struct {
  Name     string
  Password string `sanitise:"*"`
  Hash     []byte `sanitise:"api"`
}

Calling sanitiser.Sanitise() with an instance of the User struct will return a copy with the Password field scrubbed (set to the zero value) in any context, the Hash field in the api context, and will always leave Name untouched.

When used on objects that are getting serialised together with the omitempty directive, the serialised representation will be completely clean of any sensitive data.

TODO

  • Support list of contexts in call to Sanitise()
  • Improve debug messages

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sanitise

func Sanitise(obj interface{}, context string) interface{}

func SetLogger

func SetLogger(f Logger)

Types

type Logger

type Logger func(format string, v ...interface{})

type Sanitiser

type Sanitiser interface {
	Sanitise(context string)
}

Jump to

Keyboard shortcuts

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