File tree Expand file tree Collapse file tree 4 files changed +5
-3
lines changed Expand file tree Collapse file tree 4 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ func (form *AdminUpsert) Validate() error {
55
55
& form .Id ,
56
56
validation .When (
57
57
form .admin .IsNew (),
58
- validation .Length (models .DefaultIdLength , models .DefaultIdLength ),
58
+ validation .Length (models .SnowflakeMinLen , models .SnowflakeMaxLen ),
59
59
validation .Match (idRegex ),
60
60
validation .By (validators .UniqueId (form .dao , form .admin .TableName ())),
61
61
).Else (validation .In (form .admin .Id )),
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ func (form *CollectionUpsert) Validate() error {
105
105
& form .Id ,
106
106
validation .When (
107
107
form .collection .IsNew (),
108
- validation .Length (models .DefaultIdLength , models .DefaultIdLength ),
108
+ validation .Length (models .SnowflakeMinLen , models .SnowflakeMaxLen ),
109
109
validation .Match (idRegex ),
110
110
validation .By (validators .UniqueId (form .dao , form .collection .TableName ())),
111
111
).Else (validation .In (form .collection .Id )),
Original file line number Diff line number Diff line change @@ -466,7 +466,7 @@ func (form *RecordUpsert) Validate() error {
466
466
& form .Id ,
467
467
validation .When (
468
468
form .record .IsNew (),
469
- validation .Length (models .DefaultIdLength , models .DefaultIdLength ),
469
+ validation .Length (models .SnowflakeMinLen , models .SnowflakeMaxLen ),
470
470
validation .Match (idRegex ),
471
471
validation .By (validators .UniqueId (form .dao , form .record .TableName ())),
472
472
).Else (validation .In (form .record .Id )),
Original file line number Diff line number Diff line change 9
9
const (
10
10
// DefaultIdLength is the default length of the generated model id.
11
11
DefaultIdLength = 15
12
+ SnowflakeMinLen = 8
13
+ SnowflakeMaxLen = 32
12
14
13
15
// DefaultIdAlphabet is the default characters set used for generating the model id.
14
16
DefaultIdAlphabet = "abcdefghijklmnopqrstuvwxyz0123456789"
You can’t perform that action at this time.
0 commit comments