Documentation
¶
Overview ¶
Package schema enables checking the schema, both columns and indexes, of a database.
Index ¶
Constants ¶
View Source
const ( SpannerDBType = "spanner" CockroachDBType = "cockroachdb" )
View Source
const IndexNameQuery = `
SELECT DISTINCT
index_name
FROM
information_schema.statistics
WHERE
table_name = $1
ORDER BY
index_name DESC
`
Query to return the index names for each table.
View Source
const SpannerIndexNameQuery = `
SELECT DISTINCT
index_name
FROM
information_schema.indexes
WHERE
table_name = $1
ORDER BY
index_name DESC
`
View Source
const TypesQuery = `` /* 162-byte string literal not displayed */
Query to return the typesQuery for each column in all tables.
View Source
const TypesQuerySpanner = `` /* 190-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func TableNames ¶
func TableNames(tables interface{}) []string
TableNames takes in a "table type", that is a table whose fields are slices. Each field will be interpreted as a table. TableNames returns all expected table names in a string slice with table names lowercased.
For example:
"description", "taskresult"
Types ¶
type Description ¶
Description describes the schema for all tables.
func GetDescription ¶
func GetDescription(ctx context.Context, db pool.Pool, tables interface{}, databaseType string) (*Description, error)
GetDescription returns a Description populated for every table listed in `tables`.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package exportschema contains a re-usable Main function that exports an SQL schema as a JSON seriailized schema.Description.
|
Package exportschema contains a re-usable Main function that exports an SQL schema as a JSON seriailized schema.Description. |
Click to show internal directories.
Click to hide internal directories.