Merge pull request #5675 from flycash/master
feat(validation): add Label to error struct
This commit is contained in:
commit
84dcf68cb1
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -40,9 +40,11 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 11211:11211
|
- 11211:11211
|
||||||
ssdb:
|
ssdb:
|
||||||
image: wendal/ssdb:latest
|
image: tsl0922/ssdb
|
||||||
|
env:
|
||||||
|
SSDB_PORT: 8888
|
||||||
ports:
|
ports:
|
||||||
- 8888:8888
|
- "8888:8888"
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
env:
|
env:
|
||||||
|
|||||||
@ -58,9 +58,9 @@ type ValidFormer interface {
|
|||||||
|
|
||||||
// Error show the error
|
// Error show the error
|
||||||
type Error struct {
|
type Error struct {
|
||||||
Message, Key, Name, Field, Tmpl string
|
Message, Key, Name, Field, Tmpl, Label string
|
||||||
Value interface{}
|
Value interface{}
|
||||||
LimitValue interface{}
|
LimitValue interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// String Returns the Message.
|
// String Returns the Message.
|
||||||
@ -292,6 +292,7 @@ func (v *Validation) apply(chk Validator, obj interface{}) *Result {
|
|||||||
Value: obj,
|
Value: obj,
|
||||||
Tmpl: MessageTmpls[Name],
|
Tmpl: MessageTmpls[Name],
|
||||||
LimitValue: chk.GetLimitValue(),
|
LimitValue: chk.GetLimitValue(),
|
||||||
|
Label: Label,
|
||||||
}
|
}
|
||||||
v.setError(err)
|
v.setError(err)
|
||||||
|
|
||||||
@ -324,6 +325,7 @@ func (v *Validation) AddError(key, message string) {
|
|||||||
Key: key,
|
Key: key,
|
||||||
Name: Name,
|
Name: Name,
|
||||||
Field: Field,
|
Field: Field,
|
||||||
|
Label: Label,
|
||||||
}
|
}
|
||||||
v.setError(err)
|
v.setError(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
version: "3.8"
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
container_name: "beego-redis"
|
container_name: "beego-redis"
|
||||||
@ -28,7 +27,9 @@ services:
|
|||||||
- ALLOW_EMPTY_PASSWORD=yes
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
ssdb:
|
ssdb:
|
||||||
container_name: "beego-ssdb"
|
container_name: "beego-ssdb"
|
||||||
image: wendal/ssdb
|
image: tsl0922/ssdb
|
||||||
|
environment:
|
||||||
|
- SSDB_PORT=8888
|
||||||
ports:
|
ports:
|
||||||
- "8888:8888"
|
- "8888:8888"
|
||||||
memcache:
|
memcache:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user