Format code with gofmt
Fixes getPrimaryKey for non struct type
Add tests