Skip to content

How to implement group validator? #846

Open
@nogolang

Description

@nogolang

How to implement group validator?

I have the following structure

type User struct {
	UserId        int64          `binding:"required,number"`
	Name         string         `json:"name" form:"name" binding:"gte=3"`
}

Now I need to implement findUserById , I have to verify the ID exist, so i use required.
But when I implement saveUser, I have to verify that the ID doesn't exist because my database is a self-increment ID.
They have a conflict

image

In Java spring boot, they can be distinguished by a custom group

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions