The switch/case statements in prepareInput and prepareOutput contain repeated code and repeated error message that can be factored out into methods on typeInfo.
typeMember(string) (typeMember, error) is added to get a specific member of a struct or map
getAllMembers() ([]typeMember, error) is added for when asterisk expressions need all members of a type
The local function addColumns in prepareOutput is removed and calls are replaced with the explicit code since with these changes it only added cognitive overhead.
This means that the error messages change slightly but any context lost here will be added back with PR #99 where we add the relevant raw SQL to the error.
The switch/case statements in
prepareInput
andprepareOutput
contain repeated code and repeated error message that can be factored out into methods ontypeInfo
.typeMember(string) (typeMember, error)
is added to get a specific member of a struct or mapgetAllMembers() ([]typeMember, error)
is added for when asterisk expressions need all members of a typeThe local function
addColumns
inprepareOutput
is removed and calls are replaced with the explicit code since with these changes it only added cognitive overhead.This means that the error messages change slightly but any context lost here will be added back with PR #99 where we add the relevant raw SQL to the error.