Documentation ¶
Index ¶
Constants ¶
const (
// Version is the current DBA version
Version = "v0.1.0"
)
Variables ¶
This section is empty.
Functions ¶
func EvalTemplate ¶
func EvalTemplate(v interface{}, Ctx EvalConfig) (interface{}, error)
EvalTemplate evaluates template if string, otherwise returns value as given
func MustRun ¶
func MustRun(config io.ReadWriter)
MustRun triggers the anonimyzers on the database tables. If an error occurs, execution stops.
Types ¶
type Anonymizer ¶
type Anonymizer interface { // Anonymize should run the actual anonymization // It should return an error when it fails or nil otherwise. Anonymize(*Database, EvalConfig) error // GetChangesets returns the set of changes to apply GetChangeSets(EvalConfig) }
Anonymizer is the interface implemented by tables for anonimyzing data
type Config ¶
type Config struct { EvalConfig Databases []*Database }
Config is the HCL config parsed into databases and tables
func ParseConfig ¶
func ParseConfig(configFile io.ReadWriter) (*Config, error)
ParseConfig parses the DBA config
type ConfigParseError ¶
type ConfigParseError struct {
// contains filtered or unexported fields
}
ConfigParseError denotes failing to parse configuration file.
func (ConfigParseError) Error ¶
func (pe ConfigParseError) Error() string
Error returns the formatted configuration error.
type Database ¶
Database represents the 'db' node in the config file
func (*Database) MustGetMeta ¶
func (m *Database) MustGetMeta(key string) interface{}
GetMeta retrieves value of key. Panics if key is missing
func (*Database) Run ¶
func (db *Database) Run(Ctx EvalConfig)
Run establishes DB connection and anonymizes the tables
type EvalConfig ¶
type EvalConfig struct {
*hil.EvalConfig
}
EvalConfig is the template rendering context
type Table ¶
type Table struct { Updates map[string]interface{} // contains filtered or unexported fields }
Table represents the table node in the config file
func (*Table) Anonymize ¶
func (tbl *Table) Anonymize(db *Database, Ctx EvalConfig) error
Anonymize does the actual table anonymization
func (*Table) GetChangeSets ¶
func (tbl *Table) GetChangeSets(Ctx EvalConfig) (string, []interface{})
GetChangeSets returns the set of changes to apply to the table
func (*Table) MustGetMeta ¶
func (m *Table) MustGetMeta(key string) interface{}
GetMeta retrieves value of key. Panics if key is missing
type TemplateError ¶
type TemplateError struct {
// contains filtered or unexported fields
}
TemplateError denotes failing to table update template.
func (TemplateError) Error ¶
func (te TemplateError) Error() string
Error returns the formatted template error.