-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
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
- Identified in PR: Add PostgreSQL Support #26
- Comment: Add PostgreSQL Support #26 (comment)
- Requested by: @ThaminduDilshan
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels