Skip to content

Commit

Permalink
Add field limit
Browse files Browse the repository at this point in the history
  • Loading branch information
nablaone committed Dec 30, 2024
1 parent b1b4b69 commit a5b4061
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions quesma/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,20 @@ func FieldToColumnEncoder(field string) string {
if isDigit(newField[0]) {
newField = "_" + newField
}

const maxFieldLength = 256

if len(newField) > maxFieldLength {
// TODO maybe we should return error here or truncate the field name
// for now we just log a warning
//
// importing logger causes the circular dependency
//logger.Warn().Msgf("Field name %s is too long.", newField)

// TODO So we use log package. We can configure the zerolog logger as a backend for log package.
log.Println("Field name", newField, "is too long.")
}

return newField
}

Expand Down

0 comments on commit a5b4061

Please sign in to comment.