Merge pull request #5675 from flycash/master

feat(validation): add Label to error struct
This commit is contained in:
Ming Deng 2024-07-01 19:38:47 +08:00 committed by GitHub
commit 84dcf68cb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 7 deletions

View File

@ -40,9 +40,11 @@ jobs:
ports:
- 11211:11211
ssdb:
image: wendal/ssdb:latest
image: tsl0922/ssdb
env:
SSDB_PORT: 8888
ports:
- 8888:8888
- "8888:8888"
postgres:
image: postgres:latest
env:

View File

@ -58,9 +58,9 @@ type ValidFormer interface {
// Error show the error
type Error struct {
Message, Key, Name, Field, Tmpl string
Value interface{}
LimitValue interface{}
Message, Key, Name, Field, Tmpl, Label string
Value interface{}
LimitValue interface{}
}
// String Returns the Message.
@ -292,6 +292,7 @@ func (v *Validation) apply(chk Validator, obj interface{}) *Result {
Value: obj,
Tmpl: MessageTmpls[Name],
LimitValue: chk.GetLimitValue(),
Label: Label,
}
v.setError(err)
@ -324,6 +325,7 @@ func (v *Validation) AddError(key, message string) {
Key: key,
Name: Name,
Field: Field,
Label: Label,
}
v.setError(err)
}

View File

@ -1,4 +1,3 @@
version: "3.8"
services:
redis:
container_name: "beego-redis"
@ -28,7 +27,9 @@ services:
- ALLOW_EMPTY_PASSWORD=yes
ssdb:
container_name: "beego-ssdb"
image: wendal/ssdb
image: tsl0922/ssdb
environment:
- SSDB_PORT=8888
ports:
- "8888:8888"
memcache: