Skip to content

Commit

Permalink
Mask int/float column [Close #2]
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsmfm committed Apr 18, 2017
1 parent 961665e commit b86d070
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.2.0
2 changes: 1 addition & 1 deletion example.sql
Original file line number Diff line number Diff line change
@@ -1 +1 @@
INSERT INTO `users` (name, email) VALUES ("Fumiaki MATSUSHIMA", "mtsmfm@gmail.com");
INSERT INTO `users` (name, email, lat, lng) VALUES ("Fumiaki MATSUSHIMA", "mtsmfm@gmail.com", 36.5630188, 136.6640123);
2 changes: 2 additions & 0 deletions example.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
users: # Table name
name: "AAA" # Simply replace all name with "AAA"
email: "{{.First 6}}.{{.Hashed}}.{{.Last 3}}@example.com" # You can use go template here
lat: 36.5
lng: 136.5
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ func handleLine(line string, configData map[string]map[string]*template.Template
}
insert.Rows.(sqlparser.Values)[i].(sqlparser.ValTuple)[j] = sqlparser.StrVal(buf.Bytes())
case sqlparser.NumVal:
// noop at this time
err = tmpl.Execute(&buf, &TemplateValue{Raw: string(val), Salt: string(salt)})
if err != nil {
log.Fatal(err)
}
insert.Rows.(sqlparser.Values)[i].(sqlparser.ValTuple)[j] = sqlparser.NumVal(buf.Bytes())
}
}
}
Expand Down

0 comments on commit b86d070

Please sign in to comment.