包含Mysql
除空间
类型以外的全部字段类型的验证规则
itwmw/engine-validate-mysql-rules
在项目中,将自定义规则路径注册到验证器中
\W7\Validate\Support\Storage\ValidateConfig::instance()->setRulesPath('Itwmw\\Validate\\Mysql\\Rules\\');
字段类型 | 规则名 | 参数 |
---|---|---|
bigint | mysqlBigint | unsigned |
binary | mysqlBinary | length |
bit | mysqlBit | length |
blob | mysqlBlob | length |
char | mysqlChar | length |
date | mysqlDate | - |
datetime | mysqlDatetime | - |
decimal | mysqlDecimal | unsigned,length,precision |
double | mysqlDouble | unsigned,length,precision |
enum | mysqlEnum | table,field |
float | mysqlFloat | unsigned,length,precision |
int | mysqlInt | unsigned |
json | mysqlJson | - |
longblob | mysqlLongblob | length |
longtext | mysqlLongtext | length |
mediumblob | mysqlMediumblob | length |
mediumint | mysqlMediumint | unsigned |
mediumtext | mysqlMediumtext | length |
set | mysqlSet | table,field |
smallint | mysqlSmallint | unsigned |
mysqlText | mysqlText | length |
time | mysqlTime | - |
timestamp | mysqlTimestamp | - |
tinyblob | mysqlTinyblob | length |
tinyint | mysqlTinyint | unsigned |
tinytext | mysqlTinytext | length |
varbinary | mysqlVarbinary | length |
varchar | mysqlVarchar | length |
mysqlYear | mysqlYear | - |
参数说明:
table
表名field
字段名unsigned
无符号,值为true
或false
length
字段长度precision
小数精度