Skip to content

Pointer to int and zero value #48

Open
@badoux

Description

@badoux
type Request struct {
	TestInt        *int        `form:"test_int"`
	TestString  *string   `form:"test_string"`
}

When providing empty value for "test_string" parameter(r.Form["test_string"]=""), Request.TestString will be not nil and set with the zero value "" as wanted.

But when "test_int" is provided with an empty string value(r.Form["test_int"]=""), Request.TestInt is still nil and shloud rather be set to the zero value 0.

It works great with Gorilla Schema

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