Spandoc is a tool to generate documentations from DDL of Cloud Spanner.
go get -u github.com/naoina/spandoc/cmd/spandocWrite DDL of Cloud Spanner to a file (in this example, use schema.sql).
/* This is User table. */
CREATE TABLE User (
ID STRING(MAX) NOT NULL, -- This is PK
Age INT64, -- Age of a user
CreatedAt TIMESTAMP NOT NULL, -- Created time
-- Updated time
UpdatedAt TIMESTAMP NOT NULL OPTIONS (
allow_commit_timestamp = true
),
) PRIMARY KEY(ID);Then run command below.
spandoc schema.sqlOutput:
# User
This is User table.
COLUMN | TYPE | NOT NULL | PRIMARY | OPTIONS | DESCRIPTION
------ | ---- | ---------| ------- | ------- | -----------
ID | STRING(MAX) | true | true | | This is PK
Age | INT64 | | | | Age of a user
CreatedAt | TIMESTAMP | true | | | Created time
UpdatedAt | TIMESTAMP | true | | ALLOW_COMMIT_TIMESTAMP | Updated time
MIT