Add support for unmarshalling

Add a function to unmarshal database results back into structs.