Documentation
¶
Index ¶
- Constants
- Variables
- type AdditionalComment
- type AdditionalRelation
- type ColumnCount
- type Config
- func (c *Config) FilterTables(s *schema.Schema) error
- func (c *Config) Load(configPath string, options ...Option) error
- func (c *Config) LoadConfigFile(path string) error
- func (c *Config) LoadEnviron() error
- func (c *Config) MaskedDSN() (string, error)
- func (c *Config) MergeAdditionalData(s *schema.Schema) error
- func (c *Config) ModifySchema(s *schema.Schema) error
- type DuplicateRelations
- type ER
- type Format
- type Lint
- type Option
- type RequireColumnComment
- type RequireColumns
- type RequireColumnsColumn
- type RequireForeignKeyIndex
- type RequireTableComment
- type Rule
- type RuleWarn
- type UnrelatedTable
Constants ¶
const DefaultERFormat = "png"
DefaultERFormat is the default ER diagram format
Variables ¶
var DefaultDistance = 1
DefaultDistance is the default distance between tables that display relations in the ER
Functions ¶
This section is empty.
Types ¶
type AdditionalComment ¶
type AdditionalComment struct {
Table string `yaml:"table"`
TableComment string `yaml:"tableComment"`
ColumnComments map[string]string `yaml:"columnComments"`
}
AdditionalComment is the struct for table relation from yaml
type AdditionalRelation ¶
type AdditionalRelation struct {
Table string `yaml:"table"`
Columns []string `yaml:"columns"`
ParentTable string `yaml:"parentTable"`
ParentColumns []string `yaml:"parentColumns"`
Def string `yaml:"def"`
}
AdditionalRelation is the struct for table relation from yaml
type ColumnCount ¶ added in v1.8.0
type ColumnCount struct {
Enabled bool `yaml:"enabled"`
Max int `yaml:"max"`
Exclude []string `yaml:"exclude"`
}
ColumnCount checks table column count
func (ColumnCount) Check ¶ added in v1.8.0
func (r ColumnCount) Check(s *schema.Schema, exclude []string) []RuleWarn
Check table column count
func (ColumnCount) IsEnabled ¶ added in v1.8.0
func (r ColumnCount) IsEnabled() bool
IsEnabled return Rule is enabled or not
type Config ¶
type Config struct {
Name string `yaml:"name"`
DSN string `yaml:"dsn"`
DocPath string `yaml:"docPath"`
Format Format `yaml:"format"`
ER ER `yaml:"er"`
Include []string `yaml:"include"`
Exclude []string `yaml:"exclude"`
Lint Lint `yaml:"lint"`
LintExclude []string `yaml:"lintExclude"`
Relations []AdditionalRelation `yaml:"relations"`
Comments []AdditionalComment `yaml:"comments"`
Dict dict.Dict `yaml:"dict"`
MergedDict dict.Dict `yaml:"-"`
}
Config is tbls config
func (*Config) FilterTables ¶ added in v1.28.0
FilterTables filter tables from schema.Schema
func (*Config) LoadConfigFile ¶
LoadConfigFile load config file
func (*Config) LoadEnviron ¶ added in v1.9.0
LoadEnviron load environment variables
func (*Config) MergeAdditionalData ¶ added in v1.8.0
MergeAdditionalData merge relations: comments: to schema.Schema
type DuplicateRelations ¶ added in v1.19.0
type DuplicateRelations struct {
Enabled bool `yaml:"enabled"`
}
DuplicateRelations checks duplicate table relations
func (DuplicateRelations) Check ¶ added in v1.19.0
func (r DuplicateRelations) Check(s *schema.Schema, exclude []string) []RuleWarn
Check duplicate table relations
func (DuplicateRelations) IsEnabled ¶ added in v1.19.0
func (r DuplicateRelations) IsEnabled() bool
IsEnabled return Rule is enabled or not
type ER ¶ added in v1.10.0
type ER struct {
Skip bool `yaml:"skip"`
Format string `yaml:"format"`
Comment bool `yaml:"comment"`
Distance *int `yaml:"distance"`
}
ER is er setting
type Lint ¶ added in v1.8.0
type Lint struct {
RequireTableComment RequireTableComment `yaml:"requireTableComment"`
RequireColumnComment RequireColumnComment `yaml:"requireColumnComment"`
ColumnCount ColumnCount `yaml:"columnCount"`
RequireColumns RequireColumns `yaml:"requireColumns"`
DuplicateRelations DuplicateRelations `yaml:"duplicateRelations"`
RequireForeignKeyIndex RequireForeignKeyIndex `yaml:"requireForeignKeyIndex"`
}
Lint is the struct for lint config
type Option ¶ added in v1.10.0
Option function change Config
type RequireColumnComment ¶ added in v1.8.0
type RequireColumnComment struct {
Enabled bool `yaml:"enabled"`
Exclude []string `yaml:"exclude"`
ExcludedTables []string `yaml:"excludedTables"`
}
RequireColumnComment checks column comment
func (RequireColumnComment) Check ¶ added in v1.8.0
func (r RequireColumnComment) Check(s *schema.Schema, exclude []string) []RuleWarn
Check column comment
func (RequireColumnComment) IsEnabled ¶ added in v1.8.0
func (r RequireColumnComment) IsEnabled() bool
IsEnabled return Rule is enabled or not
type RequireColumns ¶ added in v1.12.0
type RequireColumns struct {
Enabled bool `yaml:"enabled"`
Columns []RequireColumnsColumn `yaml:"columns"`
}
RequireColumns checks if the table has specified columns
func (RequireColumns) Check ¶ added in v1.12.0
func (r RequireColumns) Check(s *schema.Schema, exclude []string) []RuleWarn
Check the existence of a table columns
func (RequireColumns) IsEnabled ¶ added in v1.12.0
func (r RequireColumns) IsEnabled() bool
IsEnabled return Rule is enabled or not
type RequireColumnsColumn ¶ added in v1.12.0
RequireColumnsColumn is required column
type RequireForeignKeyIndex ¶ added in v1.20.0
type RequireForeignKeyIndex struct {
Enabled bool `yaml:"enabled"`
Exclude []string `yaml:"exclude"`
}
RequireForeignKeyIndex checks if the foreign key columns have an index
func (RequireForeignKeyIndex) Check ¶ added in v1.20.0
func (r RequireForeignKeyIndex) Check(s *schema.Schema, exclude []string) []RuleWarn
Check if the foreign key columns have an index
func (RequireForeignKeyIndex) IsEnabled ¶ added in v1.20.0
func (r RequireForeignKeyIndex) IsEnabled() bool
IsEnabled return Rule is enabled or not
type RequireTableComment ¶ added in v1.8.0
RequireTableComment checks table comment
func (RequireTableComment) Check ¶ added in v1.8.0
func (r RequireTableComment) Check(s *schema.Schema, exclude []string) []RuleWarn
Check table comment
func (RequireTableComment) IsEnabled ¶ added in v1.8.0
func (r RequireTableComment) IsEnabled() bool
IsEnabled return Rule is enabled or not
type UnrelatedTable ¶ added in v1.8.2
type UnrelatedTable struct {
}
UnrelatedTable checks isolated table
func (UnrelatedTable) Check ¶ added in v1.8.2
func (r UnrelatedTable) Check(s *schema.Schema, exclude []string) []RuleWarn
Check table relation
func (UnrelatedTable) IsEnabled ¶ added in v1.8.2
func (r UnrelatedTable) IsEnabled() bool
IsEnabled return Rule is enabled or not