Closed sorenbs closed 5 years ago
Hi. Just some notes:
There is no Date
or DateTime
in GraphQL spec AFAIK. You would normally define those as scalars yourself (eg, using something like graphql-iso-date).
Prisma 1.18
defines a DateTime
but not Date
. I'm not sure if there is a Date
in trunk.
PS I came across this issue because I'm trying to map a date YYYY-MM-DD
in datamodel.prisma
I will like to have Long so I will be able to to store any mac address as a decimal number on the database. Right now Im using Float but for this case Long will be perfect because mac addresses can't have decimals.
This will be the biggest mac address FF:FF:FF:FF:FF:FF which in decimal equals to 281474976710655
I could store this number as a string but I need it as number so I can sort them from greatest to smallest.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
I think we better have the ability to add big decimals with higher precision points. Having issues when storing latitude and longitude values. When we give 6.940043516608129 it stores 6.94004351660813 That's 100m difference 🙂
@THPubs did you got any solution for big decimals with higher precision points
@niktrix, For now, had to manually set the field to float8
. But that's not a good solution. We use this in many places, If we forget to update the field manually the system will record wrong coordinates! Hope the guys fix it soon.
@THPubs Are you sure that a 15 decimal (0.000000000000001) difference is 100 meters?
According to wikipedia, 8 decimal degrees about 1mm precision
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
Use-case for Long
or BigInt
-- Twitter API numeric id
is greater than 52 bits. You can't use a string because ordering strings doesn't work the same as ordering numbers. You can't use Float
, either, because the number is too large. Attempting to add a float value of 1154057692723519500
throws the following:
Float or Int value is too big to fit in double (line 1, column 11)
sooo....
@sorenbs Please support Long
As we introduce support for multiple databases we need to consider how the underlying types of each database are exposed. This document outlines all types supported by each database as well as the build in scalars in the GraphQL spec.
Overview
GraphQL
spec
Int
Float
String
Boolean
ID
Prisma specific GraphQL Scalars
Spec
Long
BigInt
BigDecimal
DateTime
Json
MySQL
Spec
Integer (Exact Value)
Fixed Point (Exact Value)
Decimal
andNumeric
types are equivalentprecision
is the total number of digits andscale
is the number of digits following decimal pointDECIMAL(5,2)
ranges from-999.99
to999.99
Floating Point (Approximate Value)
Float
is represented as 4 byteDouble
is represented as 8 byteBit
Date
DateTime
TimeStamp
Time
Year
Char
VarChar
Binary and VarBinary
Blob and Text
Elastic Search
Spec
Text
Keyword
long
integer
short
byte
double
float
half_float
scaled_float
Date
Boolean
Binary
integer_range
float_range
long_range
double_range
date_range
ip_range
Array
Object
Nested
geo_point
geo_shape
ip
completion
token_count
MongoDB
Spec
Max document size is 16 MB
double
String
object
array
binData
objectId
boolean
date
null
regex
int
long
decimal
PostgreSQL
Spec
Numeric values
char
varchar
text
money
bytea
Date/Time Types
Boolean