www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D money data type compatible with postgresql money

reply =?UTF-8?B?VsOhY2xhdiBLb3rDoWs=?= <sudoman281 gmail.com> writes:
Hello, I have a column of type money in my database. I need to 
pull the data from the db in my vibe.d backend, but it can't 
handle such data type. How can I do it? Should I use some library 
(which?)? Thanks.
Nov 17 2018
next sibling parent Alex <sascha.orlov gmail.com> writes:
On Saturday, 17 November 2018 at 11:48:56 UTC, Václav Kozák wrote:
 Hello, I have a column of type money in my database. I need to 
 pull the data from the db in my vibe.d backend, but it can't 
 handle such data type. How can I do it? Should I use some 
 library (which?)? Thanks.
At code.dlang.org there are some... Maybe this one? https://code.dlang.org/packages/decimal or this? https://code.dlang.org/packages/money
Nov 17 2018
prev sibling parent reply Daniel =?UTF-8?B?S296w6Fr?= <kozzi11 gmail.com> writes:
On Saturday, 17 November 2018 at 11:48:56 UTC, Václav Kozák wrote:
 Hello, I have a column of type money in my database. I need to 
 pull the data from the db in my vibe.d backend, but it can't 
 handle such data type. How can I do it? Should I use some 
 library (which?)? Thanks.
You could use row.as!PGnumeric (I know that you are using vibe-d-postgresql package) to get string representation of decimal or numeric type from postregsql than you can use one of those packages Alex has mentioned
Nov 17 2018
parent Daniel =?UTF-8?B?S296w6Fr?= <kozzi11 gmail.com> writes:
On Saturday, 17 November 2018 at 12:35:45 UTC, Daniel Kozák wrote:
 On Saturday, 17 November 2018 at 11:48:56 UTC, Václav Kozák 
 wrote:
 Hello, I have a column of type money in my database. I need to 
 pull the data from the db in my vibe.d backend, but it can't 
 handle such data type. How can I do it? Should I use some 
 library (which?)? Thanks.
You could use row.as!PGnumeric (I know that you are using vibe-d-postgresql package) to get string representation of decimal or numeric type from postregsql than you can use one of those packages Alex has mentioned
BTW. https://denizzzka.github.io/dpq2/docs/dpq2/conv/to_d_types.html should help you to know how are types mapped from postgresql to D types
Nov 17 2018