News for hackers. Stuff that matters.
Re:We saved $50k/year with a Go microservice coded in a hack... by friedman23 on Tuesday April 10, 2018 @09:26PM (#16807286)
Is `value` a string here?
Re:We saved $50k/year with a Go microservice coded in a hack... by roel_v on Wednesday April 11, 2018 @06:07AM (#16809585)
I once implemented a variation of this where there was a column called 'data_type', the valid values were the various SQL data types, and in code I would do a switch() on the (string) value of that column and then cast the contents of the 'value' column based on that... Ah the folly of youth...
Re:We saved $50k/year with a Go microservice coded in a hack... by any626 on Tuesday April 10, 2018 @09:37PM (#16807330)
Depends

You could have

    property_id, user_id, value(string)
    1 (assume age), 1213,    60
    2 (gender),     1213,    female
or

    property_id, user_id, value_str, value_int
    1 (assume age), 1213,    null, 60
    2 (gender),     1213,    female, null
or have a mapping in the application to get the type of the property. Plenty of ways to handle it.