Documentation ¶
Overview ¶
Package metadata contains types that model source metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct { Name string `json:"name" yaml:"name"` Position int64 `json:"position" yaml:"position"` PrimaryKey bool `json:"primary_key" yaml:"primary_key"` BaseType string `json:"base_type" yaml:"base_type"` ColumnType string `json:"column_type" yaml:"column_type"` Kind kind.Kind `json:"kind" yaml:"kind"` Nullable bool `json:"nullable" yaml:"nullable"` DefaultValue string `json:"default_value,omitempty" yaml:"default_value,omitempty"` Comment string `json:"comment,omitempty" yaml:"comment,omitempty"` }
Column models metadata for a particular column of a data source.
type Schema ¶
type Schema struct { // Name is the schema name, such as "public". Name string `json:"schema" yaml:"schema"` // Catalog is the catalog name, such as "sakila". Catalog string `json:"catalog" yaml:"catalog"` // Owner is the schema owner, such as "alice". Owner string `json:"owner,omitempty" yaml:"owner,omitempty"` }
Schema models metadata for a schema.
type Source ¶
type Source struct { // Handle is the source handle. Handle string `json:"handle" yaml:"handle"` // Location is the source location such as a DB connection string, // a file path, or a URL. Location string `json:"location" yaml:"location"` // Name is the base name of the source, e.g. the base filename // or DB name etc. For example, "sakila". Name string `json:"name" yaml:"name"` // FQName is the full name of the data source, typically // including catalog/schema etc. For example, "sakila.public" FQName string `json:"name_fq" yaml:"name_fq"` // Schema is the schema name, for example "public". // This may be empty for some sources. Schema string `json:"schema,omitempty" yaml:"schema,omitempty"` // Catalog is the catalog name, for example "sakila". Catalog string `json:"catalog,omitempty" yaml:"catalog,omitempty"` // Driver is the source driver type. Driver drivertype.Type `json:"driver" yaml:"driver"` // DBDriver is the type of the underling DB driver. // This is the same value as Driver for SQL database types. DBDriver drivertype.Type `json:"db_driver" yaml:"db_driver"` // DBProduct is the DB product string, such as "PostgreSQL 9.6.17 on x86_64-pc-linux-gnu". DBProduct string `json:"db_product" yaml:"db_product"` // DBVersion is the DB version. DBVersion string `json:"db_version" yaml:"db_version"` // User is the username, if applicable. User string `json:"user,omitempty" yaml:"user,omitempty"` // Size is the physical size of the source in bytes, e.g. DB file size. Size int64 `json:"size" yaml:"size"` // TableCount is the count of tables (excluding views). TableCount int64 `json:"table_count" yaml:"table_count"` // ViewCount is the count of views. ViewCount int64 `json:"view_count" yaml:"view_count"` // Tables is the metadata for each table/view in the source. Tables []*Table `json:"tables" yaml:"tables"` // DBProperties are name-value pairs from the DB. // Typically the value is a scalar such as integer or string, but // it can be a nested value such as map or array. DBProperties map[string]any `json:"db_properties,omitempty" yaml:"db_properties,omitempty"` }
Source holds metadata for a source.
func (*Source) TableNames ¶
TableNames is a convenience method that returns md's table names.
type Table ¶
type Table struct { // Name is the table name, such as "actor". Name string `json:"name" yaml:"name"` // FQName is the fully-qualified name, such as "sakila.public.actor" FQName string `json:"name_fq,omitempty" yaml:"name_fq,omitempty"` // TableType indicates if this is a "table" or "view". The value // is driver-independent. See DBTableType for the driver-dependent // value. TableType string `json:"table_type,omitempty" yaml:"table_type,omitempty"` // DBTableType indicates if this is a table or view, etc. // The value is driver-dependent, e.g. "BASE TABLE" or "VIEW" for postgres. DBTableType string `json:"table_type_db,omitempty" yaml:"table_type_db,omitempty"` // RowCount is the number of rows in the table. RowCount int64 `json:"row_count" yaml:"row_count"` // Size is the physical size of the table in bytes. For a view, this // may be nil. Size *int64 `json:"size,omitempty" yaml:"size,omitempty"` // Comment is the comment for the table. Typically empty. Comment string `json:"comment,omitempty" yaml:"comment,omitempty"` // Columns holds the metadata for the table's columns. Columns []*Column `json:"columns" yaml:"columns"` }
Table models table (or view) metadata.
Click to show internal directories.
Click to hide internal directories.