Repository: cloudspannerecosystem/harbourbridge
Pull request #5 (2020-01-23 05:56:35)

Add internal utilities.
Add package internal, which implements database-agnostic functionality.



Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0da82f1..4475262 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -5,13 +5,12 @@ version: 2
 jobs:
   build_and_test:
     docker:
-      - image: circleci/golang:1.9
+      - image: circleci/golang:1.13
 
     working_directory: /go/src/github.com/cloudspannerecosystem/harbourbridge
 
     steps:
       - checkout
-      - run: go get -v -t -d ./...
       - run: go test -v ./...
 
 workflows:
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..f57f28d
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,14 @@
+module harbourbridge
+
+go 1.13
+
+require (
+	cloud.google.com/go v0.46.3
+	cloud.google.com/go/spanner v1.0.1-0.20191018063856-b24632667359
+	github.com/goware/modvendor v0.0.0-20190516042800-ce72b408a8fe // indirect
+	github.com/lfittl/pg_query_go v1.0.0
+	github.com/mattn/go-zglob v0.0.1 // indirect
+	github.com/stretchr/testify v1.4.0
+	google.golang.org/api v0.9.0
+	google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..af5d33c
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,172 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
+cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
+cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
+cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
+cloud.google.com/go v0.46.2 h1:CzaxDL0yS5OHsygr9wRodEjP93JHp67vzlRDGlVZTJw=
+cloud.google.com/go v0.46.2/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
+cloud.google.com/go v0.46.3 h1:AVXDdKsrtX33oR9fbCMu/+c1o8Ofjq6Ku/MInaLVg5Y=
+cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
+cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
+cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
+cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
+cloud.google.com/go/spanner v1.0.0 h1:jLKThep5kbWLeBhLgtEfm/OPT08n1z7itVTR82WUBQg=
+cloud.google.com/go/spanner v1.0.0/go.mod h1:z7t0U9rMHnkwMx9CZr/AVr3h60tTWRyR4n17+emFjFE=
+cloud.google.com/go/spanner v1.0.1-0.20191018063856-b24632667359 h1:hXxnJY+Igw2K1cb/DpMeI3kK2nGWs5yGNFxDeraeg/0=
+cloud.google.com/go/spanner v1.0.1-0.20191018063856-b24632667359/go.mod h1:JSevdCvTOpvGQrJS7H86d6LzGIkWxlYm8C2nc6WNjmM=
+cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
+github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
+github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
+github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
+github.com/goware/modvendor v0.0.0-20190516042800-ce72b408a8fe h1:UH0Uvgblv5tsV8QWER09+ZtxIs90pjelhtvWndSJvRM=
+github.com/goware/modvendor v0.0.0-20190516042800-ce72b408a8fe/go.mod h1:iTv+KoD55Rr5NW/P2WlDEJQ2Wa7+LRblD6/u/xJl/i0=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
+github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/lfittl/pg_query_go v1.0.0 h1:rcHZK5DBEUoxtO6dACP+UVCHKtA1ZsELBW0rSjOXMAE=
+github.com/lfittl/pg_query_go v1.0.0/go.mod h1:jcikG62RKf+NIWmbLzjjk73m4x6um2pKf3h+TJyINms=
+github.com/mattn/go-zglob v0.0.0-20180803001819-2ea3427bfa53 h1:tGfIHhDghvEnneeRhODvGYOt305TPwingKt6p90F4MU=
+github.com/mattn/go-zglob v0.0.0-20180803001819-2ea3427bfa53/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
+github.com/mattn/go-zglob v0.0.1 h1:xsEx/XUoVlI6yXjqBK062zYhRTZltCNmYPx6v+8DNaY=
+github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
+go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
+go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
+golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
+golang.org/x/exp v0.0.0-20190912063710-ac5d2bfcbfe0/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
+golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
+golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
+golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
+golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc=
+golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20190917162342-3b4f30a44f3b/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
+google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
+google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/api v0.9.0 h1:jbyannxz0XFD3zdjgrSUsaJbgpH4eTrkdhRChkHPfO8=
+google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 h1:Ex1mq5jaJof+kRnYi3SlYJ8KKa9Ao3NHyIT5XJ1gF6U=
+google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
+google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
+google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
diff --git a/internal/fixname.go b/internal/fixname.go
new file mode 100644
index 0000000..76fa252
--- /dev/null
+++ b/internal/fixname.go
@@ -0,0 +1,42 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+	"regexp"
+)
+
+var nameRegexp = regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9_]*$")
+var badFirstChar = regexp.MustCompile("^[^a-zA-Z]")
+var badOtherChar = regexp.MustCompile("[^a-zA-Z0-9_]")
+
+// FixName maps a table_name, column_name or index_name into something
+// spanner will accept. table_name, column_name or index_name must all
+// adhere to the following regexp:
+//   {a-z|A-Z}[{a-z|A-Z|0-9|_}+]
+// If the first character of the name is not allowed, we replace it by "A".
+// We replace all other problem characters by "_".
+// Returns a Spanner-acceptable name, and whether we had to change the name.
+func FixName(name string) (string, bool) {
+	if nameRegexp.MatchString(name) {
+		return name, false
+	}
+	if len(name) == 0 {
+		return "BogusEmptyId", true // Don't expect this case.
+	}
+	name = badFirstChar.ReplaceAllString(name, "A")
+	name = badOtherChar.ReplaceAllString(name, "_")
+	return name, true
+}
diff --git a/internal/progress.go b/internal/progress.go
new file mode 100644
index 0000000..16e267b
--- /dev/null
+++ b/internal/progress.go
@@ -0,0 +1,85 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package internal implements database-agnostic functionality for
+// HarbourBridge.
+package internal
+
+import "fmt"
+
+// Progress provides console progress functionality. i.e. it reports what
+// percentage of a task is complete to the console, overwriting previous
+// progress percentage with new progress.
+type Progress struct {
+	total    int64  // How much we have to do.
+	progress int64  // How much we have done so far.
+	pct      int    // Percentage done i.e. progress/total * 100
+	message  string // Name of task being monitored.
+	verbose  bool   // If true, print detailed info about each progress step.
+}
+
+// NewProgress creates and returns a Progress instance.
+func NewProgress(total int64, message string, verbose bool) *Progress {
+	p := &Progress{total, 0, 0, message, verbose}
+	if total == 0 {
+		p.pct = 100
+	}
+	p.report(true)
+	return p
+}
+
+// MaybeReport updates the state of p with the new 'progress' measure.
+// If this update changes pct (integer part of percentage-done),
+// MaybeReport will print out the new percentage, overwriting the previous
+// percentage.
+func (p *Progress) MaybeReport(progress int64) {
+	if progress > p.progress {
+		p.progress = progress
+		var pct int
+		if p.total > 0 {
+			pct = int((progress * 100) / p.total)
+		} else {
+			pct = 100
+		}
+		if pct > 100 {
+			pct = 100
+		}
+		if pct > p.pct {
+			p.pct = pct
+			p.report(false)
+		}
+
+	}
+}
+
+// Done signals completion, and will report 100% if it hasn't already
+// been reported.
+func (p *Progress) Done() {
+	p.MaybeReport(p.total)
+}
+
+func (p *Progress) report(firstCall bool) {
+	if p.verbose {
+		fmt.Printf("%s: %2d%%\n", p.message, p.pct)
+		return
+	}
+	if firstCall {
+		fmt.Printf("%s: %2d%%", p.message, p.pct)
+	} else {
+		fmt.Printf("\b\b\b%2d%%", p.pct)
+	}
+	if p.pct == 100 {
+		fmt.Printf("\n")
+	}
+}
diff --git a/internal/reader.go b/internal/reader.go
new file mode 100644
index 0000000..3625979
--- /dev/null
+++ b/internal/reader.go
@@ -0,0 +1,60 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+	"bufio"
+	"fmt"
+	"io"
+)
+
+// Reader is a simple line-reader wrapper around bufio.Reader
+// that provides line number, file offset, and cached eof state.
+// Errors are printed (via fmt.Print) and then treated as eof.
+type Reader struct {
+	LineNumber int // Starting at line 1
+	Offset     int // Character offset from start of input. Starts with character 1.
+	EOF        bool
+	r          *bufio.Reader
+	progress   *Progress
+}
+
+// NewReader builds and returns an instance of Reader.
+func NewReader(r *bufio.Reader, progress *Progress) *Reader {
+	return &Reader{LineNumber: 1, Offset: 1, EOF: false, r: r, progress: progress}
+}
+
+// ReadLine returns a line of input.
+func (r *Reader) ReadLine() []byte {
+	if r.EOF {
+		return []byte{}
+	}
+	b, err := r.r.ReadBytes('\n')
+	if err == io.EOF {
+		r.EOF = true
+	} else if err != nil {
+		fmt.Printf("Error reading input data: %v\n", err)
+		return []byte{}
+	}
+	r.Offset += len(b)
+	// If ReadBytes returns eof, then we didn't get a new line.
+	if !r.EOF {
+		r.LineNumber++
+	}
+	if r.progress != nil {
+		r.progress.MaybeReport(int64(r.Offset - 1))
+	}
+	return b
+}
diff --git a/spanner/ddl/ast.go b/spanner/ddl/ast.go
new file mode 100644
index 0000000..875016c
--- /dev/null
+++ b/spanner/ddl/ast.go
@@ -0,0 +1,256 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package ddl provides a go representation of Spanner DDL
+// as well as helpers for building and manipulating Spanner DDL.
+// We only implement enough DDL types to meet the needs of HarbourBridge.
+//
+// Definitions are from
+// https://cloud.google.com/spanner/docs/data-definition-language.
+// Before defining each type, we give the snippet from this definition.
+//
+// We use go interface types to preserve the structural constraints of
+// Spanner DDL. For example, suppose ScalarType could be either
+// an INT or a STRING with a length specifier:
+//    ScalarType := INT | STRING( length )
+// then we use a go interface type to encode ScalarType:
+//    type ScalarType interface {
+//        PrintScalarType() string  // To print ScalarTypes types.
+//    }
+// and struct types for each case:
+//    type Int struct { }
+//    type String struct { length int64 }
+// and finally, we define functions:
+//    func (i Int) PrintScalarType() { ... }
+//    func (s String) PrintScalarType() { .. }
+//
+// The net result is that the only way to build a ScalarType
+// is using Int or String.
+package ddl
+
+import (
+	"fmt"
+	"strings"
+)
+
+// Length encodes the following Spanner DDL definition:
+//     length:
+//        { int64_value | MAX }
+type Length interface {
+	PrintLength() string
+}
+
+// Int64Length wraps an integer length specifier.
+type Int64Length struct{ Value int64 }
+
+// MaxLength represents "MAX".
+type MaxLength struct{}
+
+// Interface validation for Length.
+var _ = []Length{Int64Length{}, MaxLength{}}
+
+// PrintLength unparses Int64Length.
+func (i Int64Length) PrintLength() string { return fmt.Sprintf("%d", i.Value) }
+
+// PrintLength unparses MaxLength.
+func (m MaxLength) PrintLength() string { return fmt.Sprintf("MAX") }
+
+// ScalarType encodes the following DDL definition:
+//     scalar_type:
+//        { BOOL | INT64 | FLOAT64 | STRING( length ) | BYTES( length ) | DATE | TIMESTAMP }
+type ScalarType interface {
+	PrintScalarType() string
+}
+
+// Bool encodes DDL BOOL.
+type Bool struct{}
+
+// Bytes encodes DDL BYTES( length ).
+type Bytes struct{ Len Length }
+
+// Date encodes DDL DATE.
+type Date struct{}
+
+// Float64 encodes DDL FLOAT64.
+type Float64 struct{}
+
+// Int64 encodes DDL INT64.
+type Int64 struct{}
+
+// String encodes DDL STRING.
+type String struct{ Len Length }
+
+// Timestamp encodes DDL TIMESTAMP.
+type Timestamp struct{}
+
+// Interface validation for ScalarTypes
+var _ = []ScalarType{Bool{}, Bytes{}, Date{}, Float64{}, Int64{}, String{}}
+
+// PrintScalarType unparses Bool.
+func (b Bool) PrintScalarType() string { return "BOOL" }
+
+// PrintScalarType unparses Bytes.
+func (b Bytes) PrintScalarType() string { return fmt.Sprintf("BYTES(%s)", b.Len.PrintLength()) }
+
+// PrintScalarType unparses Date.
+func (d Date) PrintScalarType() string { return "DATE" }
+
+// PrintScalarType unparses Float64
+func (g Float64) PrintScalarType() string { return "FLOAT64" }
+
+// PrintScalarType unparses Int64
+func (i Int64) PrintScalarType() string { return "INT64" }
+
+// PrintScalarType unparses String
+func (s String) PrintScalarType() string { return fmt.Sprintf("STRING(%s)", s.Len.PrintLength()) }
+
+// PrintScalarType unparses Timestamp
+func (t Timestamp) PrintScalarType() string { return "TIMESTAMP" }
+
+// ColumnDef encodes the following DDL definition:
+//     column_def:
+//       column_name {scalar_type | array_type} [NOT NULL] [options_def]
+type ColumnDef struct {
+	Name    string
+	T       ScalarType
+	IsArray bool // When false, this column has type T; when true, it is an array of type T.
+	NotNull bool
+	Comment string
+}
+
+// Config controls how AST nodes are printed (aka unparsed).
+type Config struct {
+	Comments   bool // If true, print comments.
+	ProtectIds bool // If true, table and col names are quoted using backticks (avoids reserved-word issue).
+}
+
+func (c Config) quote(s string) string {
+	if c.ProtectIds {
+		return "`" + s + "`"
+	}
+	return s
+}
+
+// PrintColumnDef unparses ColumnDef and returns it as well as any ColumnDef
+// comment. These are returned as separate strings to support formatting
+// needs of PrintCreateTable.
+func (cd ColumnDef) PrintColumnDef(c Config) (string, string) {
+	s := fmt.Sprintf("%s %s", c.quote(cd.Name), cd.PrintColumnDefType())
+	if cd.NotNull {
+		s += " NOT NULL"
+	}
+	return s, cd.Comment
+}
+
+// PrintColumnDefType unparses the type encoded in a ColumnDef.
+func (cd ColumnDef) PrintColumnDefType() string {
+	t := cd.T.PrintScalarType()
+	if cd.IsArray {
+		return fmt.Sprintf("ARRAY<%s>", t)
+	}
+	return t
+}
+
+// IndexKey encodes the following DDL definition:
+//     primary_key:
+//       PRIMARY KEY ( [key_part, ...] )
+//     key_part:
+//        column_name [{ ASC | DESC }]
+type IndexKey struct {
+	Col  string
+	Desc bool // Default order is ascending i.e. Desc = false.
+}
+
+// PrintIndexKey unparses the index keys.
+func (pk IndexKey) PrintIndexKey(c Config) string {
+	col := c.quote(pk.Col)
+	if pk.Desc {
+		return fmt.Sprintf("%s DESC", col)
+	}
+	// Don't print out ASC -- that's the default.
+	return col
+}
+
+// CreateTable encodes the following DDL definition:
+//     create_table: CREATE TABLE table_name ([column_def, ...] ) primary_key [, cluster]
+type CreateTable struct {
+	Name    string
+	Cols    []string             // Provides names and order of columns
+	Cds     map[string]ColumnDef // Provides definition of columns (a map for simpler/faster lookup during type processing)
+	Pks     []IndexKey
+	Comment string
+}
+
+// PrintCreateTable unparses a CREATE TABLE statement.
+func (ct CreateTable) PrintCreateTable(config Config) string {
+	var col []string
+	var colComment []string
+	var keys []string
+	for i, cn := range ct.Cols {
+		s, c := ct.Cds[cn].PrintColumnDef(config)
+		s = "\n    " + s
+		if i < len(ct.Cols)-1 {
+			s += ","
+		} else {
+			s += " "
+		}
+		col = append(col, s)
+		colComment = append(colComment, c)
+	}
+	n := maxStringLength(col)
+	var cols string
+	for i, c := range col {
+		cols += c
+		if config.Comments && len(colComment[i]) > 0 {
+			cols += strings.Repeat(" ", n-len(c)) + " -- " + colComment[i]
+		}
+	}
+	for _, p := range ct.Pks {
+		keys = append(keys, p.PrintIndexKey(config))
+	}
+	var tableComment string
+	if config.Comments && len(ct.Comment) > 0 {
+		tableComment = "--\n-- " + ct.Comment + "\n--\n"
+	}
+	return fmt.Sprintf("%sCREATE TABLE %s (%s\n) PRIMARY KEY (%s)", tableComment, config.quote(ct.Name), cols, strings.Join(keys, ", "))
+}
+
+// CreateIndex encodes the following DDL definition:
+//     create index: CREATE [UNIQUE] [NULL_FILTERED] INDEX index_name ON table_name ( key_part [, ...] ) [ storing_clause ] [ , interleave_clause ]
+type CreateIndex struct {
+	Name  string
+	Table string
+	Keys  []IndexKey
+	// We have no requirements for unique and null-filtered options and
+	// storing/interleaving clauses yet, so we omit them for now.
+}
+
+// PrintCreateIndex unparses a CREATE INDEX statement.
+func (ci CreateIndex) PrintCreateIndex(c Config) string {
+	var keys []string
+	for _, p := range ci.Keys {
+		keys = append(keys, p.PrintIndexKey(c))
+	}
+	return fmt.Sprintf("CREATE INDEX %s ON %s (%s)", c.quote(ci.Name), c.quote(ci.Table), strings.Join(keys, ", "))
+}
+
+func maxStringLength(s []string) int {
+	n := 0
+	for _, x := range s {
+		if len(x) > n {
+			n = len(x)
+		}
+	}
+	return n
+}


Test patch:
diff --git a/internal/fixname_test.go b/internal/fixname_test.go
new file mode 100644
index 0000000..eb93df0
--- /dev/null
+++ b/internal/fixname_test.go
@@ -0,0 +1,41 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestFixName(t *testing.T) {
+	tests := []struct {
+		name     string
+		in       string
+		expected string
+		changed  bool
+	}{
+		{"good1", "mytable", "mytable", false},
+		{"good2", "mytable_nNm87", "mytable_nNm87", false},
+		{"badstart1", "_mytable", "Amytable", true},
+		{"badstart2", "8mytable", "Amytable", true},
+		{"verybad", "my\nt\ta&$#ble", "my_t_a___ble", true},
+	}
+	for _, tc := range tests {
+		n, c := FixName(tc.in)
+		assert.Equal(t, tc.expected, n, tc.name)
+		assert.Equal(t, tc.changed, c, tc.name)
+	}
+}
diff --git a/internal/progress_test.go b/internal/progress_test.go
new file mode 100644
index 0000000..bcc1c55
--- /dev/null
+++ b/internal/progress_test.go
@@ -0,0 +1,49 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+	"testing"
+	"time"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestProgress(t *testing.T) {
+	total := int64(4321)
+	p := NewProgress(total, "Progress", false)
+	assert.Equal(t, 0, p.pct)
+	time.Sleep(500 * time.Millisecond)
+	for _, v := range []int64{1000, 2000, 3000} {
+		p.MaybeReport(v)
+		assert.Equal(t, int((100*v)/total), p.pct)
+		time.Sleep(500 * time.Millisecond)
+	}
+	pct := p.pct
+	p.MaybeReport(2000)
+	assert.Equal(t, pct, p.pct) // pct is monotonic.
+	p.MaybeReport(5000)
+	assert.Equal(t, 100, p.pct) // Never exceed 100%.
+	// Test corner case where total is 0.
+	p = NewProgress(0, "Progress", false)
+	assert.Equal(t, 100, p.pct)
+}
+
+func TestDone(t *testing.T) {
+	p := NewProgress(567, "Progress", false)
+	assert.Equal(t, 0, p.pct)
+	p.Done()
+	assert.Equal(t, 100, p.pct)
+}
diff --git a/internal/reader_test.go b/internal/reader_test.go
new file mode 100644
index 0000000..a4667c5
--- /dev/null
+++ b/internal/reader_test.go
@@ -0,0 +1,61 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package internal
+
+import (
+	"bufio"
+	"strings"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+// TestReadLine tests both NewReader and ReadLine.
+func TestReadLine(t *testing.T) {
+	type expected struct {
+		data   string
+		eof    bool
+		line   int
+		offset int
+	}
+	tests := []struct {
+		name     string
+		in       string
+		expected []expected
+	}{
+		{name: "basic", in: "12345\n123\n", expected: []expected{
+			{"12345\n", false, 2, 7},
+			{"123\n", false, 3, 11},
+			{"", true, 3, 11},
+		}},
+		{name: "no newline", in: "123456789\n12", expected: []expected{
+			{"123456789\n", false, 2, 11},
+			{"12", true, 2, 13},
+			{"", true, 2, 13},
+		}},
+	}
+	for _, tc := range tests {
+		r := NewReader(bufio.NewReader(strings.NewReader(tc.in)), nil)
+		assert.Equal(t, 1, r.LineNumber, tc.name)
+		assert.Equal(t, 1, r.Offset, tc.name)
+		for _, x := range tc.expected {
+			data := string(r.ReadLine())
+			assert.Equal(t, x.data, data, tc.name)
+			assert.Equal(t, x.eof, r.EOF, tc.name)
+			assert.Equal(t, x.line, r.LineNumber, tc.name)
+			assert.Equal(t, x.offset, r.Offset, tc.name)
+		}
+	}
+}
diff --git a/spanner/ddl/ast_test.go b/spanner/ddl/ast_test.go
new file mode 100644
index 0000000..b051d27
--- /dev/null
+++ b/spanner/ddl/ast_test.go
@@ -0,0 +1,127 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ddl
+
+import (
+	"strings"
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestPrintScalarType(t *testing.T) {
+	tests := []struct {
+		in       ScalarType
+		expected string
+	}{
+		{Bool{}, "BOOL"},
+		{Int64{}, "INT64"},
+		{Float64{}, "FLOAT64"},
+		{String{MaxLength{}}, "STRING(MAX)"},
+		{String{Int64Length{42}}, "STRING(42)"},
+		{Bytes{MaxLength{}}, "BYTES(MAX)"},
+		{Bytes{Int64Length{42}}, "BYTES(42)"},
+		{Date{}, "DATE"},
+		{Timestamp{}, "TIMESTAMP"},
+	}
+	for _, tc := range tests {
+		assert.Equal(t, normalizeSpace(tc.expected), normalizeSpace(tc.in.PrintScalarType()))
+	}
+}
+
+func TestPrintColumnDef(t *testing.T) {
+	tests := []struct {
+		in         ColumnDef
+		protectIds bool
+		expected   string
+	}{
+		{in: ColumnDef{Name: "col1", T: Int64{}}, expected: "col1 INT64"},
+		{in: ColumnDef{Name: "col1", T: Int64{}, IsArray: true}, expected: "col1 ARRAY<INT64>"},
+		{in: ColumnDef{Name: "col1", T: Int64{}, NotNull: true}, expected: "col1 INT64 NOT NULL"},
+		{in: ColumnDef{Name: "col1", T: Int64{}, IsArray: true, NotNull: true}, expected: "col1 ARRAY<INT64> NOT NULL"},
+		{in: ColumnDef{Name: "col1", T: Int64{}}, protectIds: true, expected: "`col1` INT64"},
+	}
+	for _, tc := range tests {
+		s, _ := tc.in.PrintColumnDef(Config{ProtectIds: tc.protectIds})
+		assert.Equal(t, normalizeSpace(tc.expected), normalizeSpace(s))
+	}
+}
+
+func TestPrintIndexKey(t *testing.T) {
+	tests := []struct {
+		in         IndexKey
+		protectIds bool
+		expected   string
+	}{
+		{in: IndexKey{Col: "col1"}, expected: "col1"},
+		{in: IndexKey{Col: "col1", Desc: true}, expected: "col1 DESC"},
+		{in: IndexKey{Col: "col1"}, protectIds: true, expected: "`col1`"},
+	}
+	for _, tc := range tests {
+		assert.Equal(t, normalizeSpace(tc.expected), normalizeSpace(tc.in.PrintIndexKey(Config{ProtectIds: tc.protectIds})))
+	}
+}
+
+func TestPrintCreateTable(t *testing.T) {
+	cds := make(map[string]ColumnDef)
+	cds["col1"] = ColumnDef{Name: "col1", T: Int64{}, NotNull: true}
+	cds["col2"] = ColumnDef{Name: "col2", T: String{MaxLength{}}, NotNull: false}
+	cds["col3"] = ColumnDef{Name: "col3", T: Bytes{Int64Length{42}}, NotNull: false}
+	ct := CreateTable{
+		"mytable",
+		[]string{"col1", "col2", "col3"},
+		cds,
+		[]IndexKey{IndexKey{Col: "col1", Desc: true}},
+		"",
+	}
+	tests := []struct {
+		name       string
+		protectIds bool
+		expected   string
+	}{
+		{"no quote", false, "CREATE TABLE mytable (col1 INT64 NOT NULL, col2 STRING(MAX), col3 BYTES(42)) PRIMARY KEY (col1 DESC)"},
+		{"quote", true, "CREATE TABLE `mytable` (`col1` INT64 NOT NULL, `col2` STRING(MAX), `col3` BYTES(42)) PRIMARY KEY (`col1` DESC)"},
+	}
+	for _, tc := range tests {
+		assert.Equal(t, normalizeSpace(tc.expected), normalizeSpace(ct.PrintCreateTable(Config{ProtectIds: tc.protectIds})))
+	}
+}
+
+func TestPrintCreateIndex(t *testing.T) {
+	ci := CreateIndex{
+		"myindex",
+		"mytable",
+		[]IndexKey{IndexKey{Col: "col1", Desc: true}, IndexKey{Col: "col2"}},
+	}
+	tests := []struct {
+		name       string
+		protectIds bool
+		expected   string
+	}{
+		{"no quote", false, "CREATE INDEX myindex ON mytable (col1 DESC, col2)"},
+		{"quote", true, "CREATE INDEX `myindex` ON `mytable` (`col1` DESC, `col2`)"},
+	}
+	for _, tc := range tests {
+		assert.Equal(t, normalizeSpace(tc.expected), normalizeSpace(ci.PrintCreateIndex(Config{ProtectIds: tc.protectIds})))
+	}
+}
+
+func normalizeSpace(s string) string {
+	// Insert whitespace around parenthesis and commas.
+	s = strings.ReplaceAll(s, ")", " ) ")
+	s = strings.ReplaceAll(s, "(", " ( ")
+	s = strings.ReplaceAll(s, ",", " , ")
+	return strings.Join(strings.Fields(s), " ")
+}