humanmade / go-anonymize-mysqldump

Allows you to pipe data from mysqldump or an SQL file and anonymize it.
GNU General Public License v3.0
60 stars 26 forks source link

[WIP] Add additional data types #8

Open Lusitaniae opened 4 years ago

Lusitaniae commented 4 years ago

Solves #3

  1. Custom data type, it will hard code the provided string in case the data type is not supported by this tool or Faker.

  2. Add other data types, taken from this fork https://github.com/omnea/go-anonymize-mysqldump

There's a lot of copied code from the fork above, and seems they have they own fork of faker too.

May be worthwhile splitting the PR

Lusitaniae commented 4 years ago

Would be nice to merge #7 too

psociety commented 3 years ago

@Lusitaniae hi! Since this repo seems dead. How can i compile your fork? i've tried go build command, but i get a:

go: cannot find main module, but found Gopkg.lock in /home/projects/go-anonymize-mysqldump-master
    to create a module there, run:
    go mod init

go version: go1.16.6 linux/amd64

I've tried setting go env -w GO111MODULE=auto (from https://github.com/golang/go/issues/31997) but then i get a:

anonymize-mysqldump.go:7:2: cannot find package "github.com/akamensky/argparse" in any of:
    /snap/go/7954/src/github.com/akamensky/argparse (from $GOROOT)
    /home/go/src/github.com/akamensky/argparse (from $GOPATH)
anonymize-mysqldump.go:8:2: cannot find package "github.com/sirupsen/logrus" in any of:
    /snap/go/7954/src/github.com/sirupsen/logrus (from $GOROOT)
    /home/go/src/github.com/sirupsen/logrus (from $GOPATH)
anonymize-mysqldump.go:9:2: cannot find package "github.com/xwb1989/sqlparser" in any of:
    /snap/go/7954/src/github.com/xwb1989/sqlparser (from $GOROOT)
    /home/go/src/github.com/xwb1989/sqlparser (from $GOPATH)
transformation-functions.go:5:2: cannot find package "syreclabs.com/go/faker" in any of:
    /snap/go/7954/src/syreclabs.com/go/faker (from $GOROOT)
    /home/go/src/syreclabs.com/go/faker (from $GOPATH)

Seems that manually installing them works:

go get github.com/akamensky/argparse
go get github.com/sirupsen/logrus
go get github.com/xwb1989/sqlparser
go get syreclabs.com/go/faker

Could CustomPhoneNumber take field length into account? your int field seems more useful than the generic fake numbers provided by the lib : o

Lusitaniae commented 3 years ago

Haven't look in a while at this, possibly I also installed those libraries manually?

Will try to look into it later

Feel free to submit a PR to my repo, to add custom length parameter