Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultRulers ¶
DefaultRulers returns the default SQL lint rulers
Types ¶
type AllowedDDLs ¶
type AllowedDDLs struct {
CreateDatabaseStmt bool `json:"create_database_stmt" yaml:"create_database_stmt"`
AlterDatabaseStmt bool `json:"alter_database_stmt" yaml:"alter_database_stmt"`
DropDatabaseStmt bool `json:"drop_database_stmt" yaml:"drop_database_stmt"`
CreateTableStmt bool `json:"create_table_stmt" yaml:"create_table_stmt"`
DropTableStmt bool `json:"drop_table_stmt" yaml:"drop_table_stmt"`
DropSequenceStmt bool `json:"drop_sequence_stmt" yaml:"drop_sequence_stmt"`
RenameTableStmt bool `json:"rename_table_stmt" yaml:"rename_table_stmt"`
CreateViewStmt bool `json:"create_view_stmt" yaml:"create_view_stmt"`
CreateSequenceStmt bool `json:"create_sequence_stmt" yaml:"create_sequence_stmt"`
CreateIndexStmt bool `json:"create_index_stmt" yaml:"create_index_stmt"`
DropIndexStmt bool `json:"drop_index_stmt" yaml:"drop_index_stmt"`
LockTablesStmt bool `json:"lock_tables_stmt" yaml:"lock_tables_stmt"`
UnlockTablesStmt bool `json:"unlock_tables_stmt" yaml:"unlock_tables_stmt"`
CleanupTableLockStmt bool `json:"cleanup_table_lock_stmt" yaml:"cleanup_table_lock_stmt"`
RepairTableStmt bool `json:"repair_table_stmt" yaml:"repair_table_stmt"`
TruncateTableStmt bool `json:"truncate_table_stmt" yaml:"truncate_table_stmt"`
RecoverTableStmt bool `json:"recover_table_stmt" yaml:"recover_table_stmt"`
FlashBackTableStmt bool `json:"flash_back_table_stmt" yaml:"flash_back_table_stmt"`
AlterTableOption bool `json:"alter_table_option" yaml:"alter_table_option"`
AlterTableAddColumns bool `json:"alter_table_add_columns" yaml:"alter_table_add_columns"`
AlterTableAddConstraint bool `json:"alter_table_add_constraint" yaml:"alter_table_add_constraint"`
AlterTableDropColumn bool `json:"alter_table_drop_column" yaml:"alter_table_drop_column"`
AlterTableDropPrimaryKey bool `json:"alter_table_drop_primary_key" yaml:"alter_table_drop_primary_key"`
AlterTableDropIndex bool `json:"alter_table_drop_index" yaml:"alter_table_drop_index"`
AlterTableDropForeignKey bool `json:"alter_table_drop_foreign_key" yaml:"alter_table_drop_foreign_key"`
AlterTableModifyColumn bool `json:"alter_table_modify_column" yaml:"alter_table_modify_column"`
AlterTableChangeColumn bool `json:"alter_table_change_column" yaml:"alter_table_change_column"`
AlterTableRenameColumn bool `json:"alter_table_rename_column" yaml:"alter_table_rename_column"`
AlterTableRenameTable bool `json:"alter_table_rename_table" yaml:"alter_table_rename_table"`
AlterTableAlterColumn bool `json:"alter_table_alter_column" yaml:"alter_table_alter_column"`
AlterTableLock bool `json:"alter_table_lock" yaml:"alter_table_lock"`
AlterTableAlgorithm bool `json:"alter_table_algorithm" yaml:"alter_table_algorithm"`
AlterTableRenameIndex bool `json:"alter_table_rename_index" yaml:"alter_table_rename_index"`
AlterTableForce bool `json:"alter_table_force" yaml:"alter_table_force"`
AlterTableAddPartitions bool `json:"alter_table_add_partitions" yaml:"alter_table_add_partitions"`
AlterTableCoalescePartitions bool `json:"alter_table_coalesce_partitions" yaml:"alter_table_coalesce_partitions"`
AlterTableDropPartition bool `json:"alter_table_drop_partition" yaml:"alter_table_drop_partition"`
AlterTableTruncatePartition bool `json:"alter_table_truncate_partition" yaml:"alter_table_truncate_partition"`
AlterTablePartition bool `json:"alter_table_partition" yaml:"alter_table_partition"`
AlterTableEnableKeys bool `json:"alter_table_enable_keys" yaml:"alter_table_enable_keys"`
AlterTableDisableKeys bool `json:"alter_table_disable_keys" yaml:"alter_table_disable_keys"`
AlterTableRemovePartitioning bool `json:"alter_table_remove_partitioning" yaml:"alter_table_remove_partitioning"`
AlterTableWithValidation bool `json:"alter_table_with_validation" yaml:"alter_table_with_validation"`
AlterTableWithoutValidation bool `json:"alter_table_without_validation" yaml:"alter_table_without_validation"`
AlterTableSecondaryLoad bool `json:"alter_table_secondary_load" yaml:"alter_table_secondary_load"`
AlterTableSecondaryUnload bool `json:"alter_table_secondary_unload" yaml:"alter_table_secondary_unload"`
AlterTableRebuildPartition bool `json:"alter_table_rebuild_partition" yaml:"alter_table_rebuild_partition"`
AlterTableReorganizePartition bool `json:"alter_table_reorganize_partition" yaml:"alter_table_reorganize_partition"`
AlterTableCheckPartitions bool `json:"alter_table_check_partitions" yaml:"alter_table_check_partitions"`
AlterTableExchangePartition bool `json:"alter_table_exchange_partition" yaml:"alter_table_exchange_partition"`
AlterTableOptimizePartition bool `json:"alter_table_optimize_partition" yaml:"alter_table_optimize_partition"`
AlterTableRepairPartition bool `json:"alter_table_repair_partition" yaml:"alter_table_repair_partition"`
AlterTableImportPartitionTablespace bool `json:"alter_table_import_partition_tablespace" yaml:"alter_table_import_partition_tablespace"`
AlterTableDiscardPartitionTablespace bool `json:"alter_table_discard_partition_tablespace" yaml:"alter_table_discard_partition_tablespace"`
AlterTableAlterCheck bool `json:"alter_table_alter_check" yaml:"alter_table_alter_check"`
AlterTableDropCheck bool `json:"alter_table_drop_check" yaml:"alter_table_drop_check"`
AlterTableImportTablespace bool `json:"alter_table_import_tablespace" yaml:"alter_table_import_tablespace"`
AlterTableDiscardTablespace bool `json:"alter_table_discard_tablespace" yaml:"alter_table_discard_tablespace"`
AlterTableIndexInvisible bool `json:"alter_table_index_invisible" yaml:"alter_table_index_invisible"`
AlterTableOrderByColumns bool `json:"alter_table_order_by_columns" yaml:"alter_table_order_by_columns"`
AlterTableSetTiFlashReplica bool `json:"alter_table_set_ti_flash_replica" yaml:"alter_table_set_ti_flash_replica"`
}
type AllowedDMLs ¶
type AllowedDMLs struct {
SelectStmt bool `json:"select_stmt" yaml:"select_stmt"`
UnionStmt bool `json:"union_stmt" yaml:"union_stmt"`
LoadDataStmt bool `json:"load_data_stmt" yaml:"load_data_stmt"`
InsertStmt bool `json:"insert_stmt" yaml:"insert_stmt"`
DeleteStmt bool `json:"delete_stmt" yaml:"delete_stmt"`
UpdateStmt bool `json:"update_stmt" yaml:"update_stmt"`
ShowStmt bool `json:"show_stmt" yaml:"show_stmt"`
SplitRegionStmt bool `json:"split_region_stmt" yaml:"split_region_stmt"`
}
type Configuration ¶
type Configuration struct {
AllowedDDLs *AllowedDDLs `json:"allowed_ddl" yaml:"allowed_ddl"`
AllowedDMLs *AllowedDMLs `json:"allowed_dml" yaml:"allowed_dml"`
BooleanFieldLinter bool `json:"boolean_field_linter" yaml:"boolean_field_linter"`
CharsetLinter bool `json:"charset_linter" yaml:"charset_linter"`
ColumnCommentLinter bool `json:"column_comment_linter" yaml:"column_comment_linter"`
ColumnNameLinter bool `json:"column_name_linter" yaml:"column_name_linter"`
CreatedAtDefaultValueLinter bool `json:"created_at_default_value_linter" yaml:"created_at_default_value_linter"`
CreatedAtExistsLinter bool `json:"created_at_exists_linter" yaml:"created_at_exists_linter"`
CreatedAtTypeLinter bool `json:"created_at_type_linter" yaml:"created_at_type_linter"`
DestructLinter bool `json:"destruct_linter" yaml:"destruct_linter"`
FloatDoubleLinter bool `json:"float_double_linter" yaml:"float_double_linter"`
ForeignKeyLinter bool `json:"foreign_key_linter" yaml:"foreign_key_linter"`
IDExistsLinter bool `json:"id_exists_linter" yaml:"id_exists_linter"`
IDIsPrimaryLinter bool `json:"id_is_primary_linter" yaml:"id_is_primary_linter"`
IDTypeLinter bool `json:"id_type_linter" yaml:"id_type_linter"`
IndexLengthLinter bool `json:"index_length_linter" yaml:"index_length_linter"`
IndexNameLinter bool `json:"index_name_linter" yaml:"index_name_linter"`
KeywordsLinter bool `json:"keywords_linter" yaml:"keywords_linter"`
NotNullLinter bool `json:"not_null_linter" yaml:"not_null_linter"`
TableCommentLinter bool `json:"table_comment_linter" yaml:"table_comment_linter"`
TableNameLinter bool `json:"table_name_linter" yaml:"table_name_linter"`
UpdatedAtExistsLinter bool `json:"updated_at_exists_linter" yaml:"updated_at_exists_linter"`
UpdatedAtTypeLinter bool `json:"updated_at_type_linter" yaml:"updated_at_type_linter"`
UpdatedAtDefaultValueLinter bool `json:"updated_at_default_value_linter" yaml:"updated_at_default_value_linter"`
UpdatedAtOnUpdateLinter bool `json:"updated_at_on_update_linter" yaml:"updated_at_on_update_linter"`
VarcharLengthLinter bool `json:"varchar_length_linter" yaml:"varchar_length_linter"`
CompleteInsertLinter bool `json:"complete_insert_linter" yaml:"complete_insert_linter"`
ManualTimeSetterLinter bool `json:"manual_time_setter_linter" yaml:"manual_time_setter_linter"`
ExplicitCollationLinter bool `json:"explicit_collation_linter" yaml:"explicit_collation_linter"`
}
Configuration is the structure of config yaml/json file
func FromData ¶
func FromData(data []byte) (*Configuration, error)
FromData reads the data and returns the *Configuration
func FromLocal ¶
func FromLocal(filename string) (*Configuration, error)
FromLocal reads the local file and returns the *Configuration
func (*Configuration) Rulers ¶
func (c *Configuration) Rulers() (rulers []rules.Ruler, err error)
Rulers returns the rulers
func (*Configuration) ToJsonIndent ¶
func (c *Configuration) ToJsonIndent() ([]byte, error)
ToJsonIndent marshals the Configuration to JSON []byte
func (*Configuration) ToYaml ¶
func (c *Configuration) ToYaml() ([]byte, error)
ToYaml marshals the Configuration to YAML []byte
Click to show internal directories.
Click to hide internal directories.