canonical / sqlair

Friendly type mapping for SQL databases
Apache License 2.0
16 stars 9 forks source link

Refactor fetchInfo #105

Closed Aflynn50 closed 1 year ago

Aflynn50 commented 1 year ago

The logic for looking up a type name in typeNameToInfo appears in both prepareInput and prepareOutput including repeated error messages. The logic for the two cases of the error message has been moved to the function: typeNotPassedError. The internal function in prepareOutput that used to contain this code has also been removed and replaced with inline map lookups.

The error message in query.go that is triggered when two types have the same name is clarified. It is included in this PR because the old error message is of the same form as those that have been factored into the new function.