RussBaz
(Russ)
1
Hi. I can't find any information how model properties are mapped to their database representation. Can anyone point in the right direction?
I am having an issue with IP address stored as String in the Model failing to be saved in inet column in my pg instance.
Here is the error message I am getting:
message: column "original_ip" is of type inet but expression is of type text
Thanks for the help in advance!
0xTim
(Tim)
2
It's done at the driver level, so in the Postgres instance in PostgresNIO.
You can see some of the mappings at https://github.com/vapor/postgres-nio/blob/main/Sources/PostgresNIO/Data/PostgresDataType.swift and related files. That's the best place to start.
You can also see how Date
mapping is handled at https://github.com/vapor/postgres-nio/blob/main/Sources/PostgresNIO/Data/PostgresData%2BDate.swift
That should give you an idea of how to create a PostgresInet
type that you can use in your models
1 Like