Summary
The IS_MANDATORY field mapping in consent-server/internal/consentpurpose/store.go (GetPurposeElements) only handles the int64 type for the is_mandatory column:
if isMandatory, ok := row["is_mandatory"].(int64); ok {
p.IsMandatory = isMandatory != 0
}
When using the PostgreSQL driver (added in #26), if IS_MANDATORY is defined as BOOLEAN, the driver may return a native bool instead of int64. The current type assertion will fail silently, leaving p.IsMandatory as false for all rows.
The file already defines getString() and getStringPtr() cross-driver helpers for string normalization — the same pattern should be applied for boolean fields.
Suggested Fix
switch v := row["is_mandatory"].(type) {
case bool:
p.IsMandatory = v
case int64:
p.IsMandatory = v != 0
}
Alternatively, introduce a getBool(row map[string]interface{}, key string) bool helper (similar to getString) to normalize boolean values across MySQL, PostgreSQL, and SQLite drivers.
References
Summary
The
IS_MANDATORYfield mapping inconsent-server/internal/consentpurpose/store.go(GetPurposeElements) only handles theint64type for theis_mandatorycolumn:When using the PostgreSQL driver (added in #26), if
IS_MANDATORYis defined asBOOLEAN, the driver may return a nativeboolinstead ofint64. The current type assertion will fail silently, leavingp.IsMandatoryasfalsefor all rows.The file already defines
getString()andgetStringPtr()cross-driver helpers for string normalization — the same pattern should be applied for boolean fields.Suggested Fix
Alternatively, introduce a
getBool(row map[string]interface{}, key string) boolhelper (similar togetString) to normalize boolean values across MySQL, PostgreSQL, and SQLite drivers.References