Whoa. I did not realise this. Thanks for the help.
திங்., 15 ஏப்., 2019, பிற்பகல் 9:54 அன்று, Marvin Renich
எழுதியது:
> Roger and Jan have given you good answers, but I would like to comment
> on another aspect of your code.
>
> * Sankar [190415 04:53]:
> > type weekday string
> >
> > const (
>
Roger and Jan have given you good answers, but I would like to comment
on another aspect of your code.
* Sankar [190415 04:53]:
> type weekday string
>
> const (
> Monday weekday = "Monday"
> Tuesday = "Tuesday"
> .
> .
> .
> )
Note that the type of Monday will be weekday, while the t
thanks guys.
திங்., 15 ஏப்., 2019, பிற்பகல் 2:30 அன்று, roger peppe
எழுதியது:
> Go doesn't have enum types. For any given type, even if there are
> constants of that type, that doesn't mean that those are all the valid
> values of that type. For that reason, Go doesn't provide any specific
> fun
On Mon, Apr 15, 2019 at 10:53 AM Sankar wrote:
> I want to evaluate if the string variable `day` is one of the valid
permitted values for the [Ww]eekday custom type. What is the recommended /
right go way of doing this ?
Go has no enums and type weekday has no permitted/not permitted values.
Yo
Go doesn't have enum types. For any given type, even if there are constants
of that type, that doesn't mean that those are all the valid values of that
type. For that reason, Go doesn't provide any specific functionality to do
what you'd like.
I'd suggest creating a map that holds all the valid we
Hi,
I have the following Go type.
```
type weekday string
const (
Monday weekday = "Monday"
Tuesday = "Tuesday"
.
.
.
)
```
Now I have a function that receives a string parameter and I want to
evaluate if it s a valid weekday or not. Say:
```
func handler(w http.ResponseWriter, r *h