mask

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

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

Package files

mask.go model.go

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

Documentation

Overview

Package mask provides the service layer for managing masks that need to be applied to results before they are returned.

Index

Constants

View Source
const (
	Collection        = "query_masks"
	CollectionHistory = "query_masks_history"
)

Contains the name of Mongo collections.

View Source
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

View Source
var (
	ErrNotFound = errors.New("Mask Not found")
)

Set of error variables.

Functions

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.

Types

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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