# README
mask
import "github.com/coralproject/shelf/internal/xenia/mask"
Overview
Package mask provides the service layer for managing masks that need to be applied to results before they are returned.
Index
- Constants
- Variables
- func Delete(context interface{}, db *db.DB, collection string, field string) error
- func GetAll(context interface{}, db *db.DB, tags []string) (map[string]Mask, error)
- func GetByCollection(context interface{}, db *db.DB, collection string) (map[string]Mask, error)
- func Upsert(context interface{}, db *db.DB, mask Mask) error
- type Mask
Package files
Constants
const (
Collection = "query_masks"
CollectionHistory = "query_masks_history"
)
Contains the name of Mongo collections.
const (
MaskRemove = "remove" // Field is removed.
MaskAll = "all" // Everything is masked.
MaskEmail = "email" // Email based masking.
MaskRight = "right" // Mask everything except last n characters. Default 4.
MaskLeft = "left" // Mask everything except first n characters. Default 4.
)
Set of query types we expect to receive.
Variables
var (
ErrNotFound = errors.New("Mask Not found")
)
Set of error variables.
func Delete
func Delete(context interface{}, db *db.DB, collection string, field string) error
Delete is used to remove an existing query mask document.
func GetAll
func GetAll(context interface{}, db *db.DB, tags []string) (map[string]Mask, error)
GetAll retrieves a list of query masks.
func GetByCollection
func GetByCollection(context interface{}, db *db.DB, collection string) (map[string]Mask, error)
GetByCollection retrieves the masks for the specified collection.
func Upsert
func Upsert(context interface{}, db *db.DB, mask Mask) error
Upsert is used to create or update an existing query Mask document.
type Mask
type Mask struct {
Collection string `bson:"collection" json:"collection" validate:"required"`
Field string `bson:"field" json:"field" validate:"required"`
Type string `bson:"type" json:"type" validate:"required,min=3"`
}
Mask contains information about what needs to be masked.
func GetByName
func GetByName(context interface{}, db *db.DB, collection string, field string) (Mask, error)
GetByName retrieves the document for the specified query mask.
func GetLastHistoryByName
func GetLastHistoryByName(context interface{}, db *db.DB, collection string, field string) (Mask, error)
GetLastHistoryByName gets the last written query mask within the history.
func (Mask) Validate
func (m Mask) Validate() error
Validate checks the set value for consistency.
Generated by godoc2md