Skip to content

How to check if a parameter is passed in? #4251

Open
@zcfh

Description

@zcfh
type queryConfInfoHandler struct {
	ConfName  string `json:"conf_name"`
}

For example, in the struct above, how do I know whether conf_name is passed in the client's json? Because it is null when it is not passed in, but it is also possible that the client passed in a empty value.

One way I know is to change the type to *string to determine whether the field is nil. I want to know if the gin framework has some built-in checking capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions