You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-15
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ The ORM main philosophy is "If you know SQL, you know Drizzle ORM". We follow th
14
14
15
15
Drizzle ORM is being battle-tested on production projects by multiple teams 🚀 Give it a try and let us know if you have any questions or feedback on [Discord](https://discord.gg/yfjTbVXMW4).
Copy file name to clipboardExpand all lines: docs/custom-types.md
+16-8
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ Each type creation should use 2 classes:
27
27
- Builder class is responsible for storing TS return type for specific database datatype and override build function to return ready to use column in table
28
28
29
29
-`TData` - extends return type for column. Current example will infer string type for current datatype used in schema definition
> `$pgColumnBuilderBrand` should be changed and be equal to class name for new data type builder
48
49
49
50
### Column class explanation - (postgresql text data type example)
51
+
50
52
---
51
53
Column class has set of types/functions, that could be overridden to get needed behavior for custom type
52
54
53
55
-`TData` - extends return type for column. Current example will infer string type for current datatype used in schema definition
54
56
55
-
-`getSQLType()` - function, that shows datatype name in database and will be used in migration generation
57
+
-`getSQLType()` - function, that shows datatype name in database and will be used in migration generation
56
58
57
-
-`mapFromDriverValue` - interceptor between database and select query execution. If you want to modify/map/change value for specific data type, it could be done here
59
+
-`mapFromDriverValue()` - interceptor between database and select query execution. If you want to modify/map/change value for specific data type, it could be done here
-`mapToDriverValue` - interceptor between user input for insert/update queries and database query. If you want to modify/map/change value for specific data type, it could be done here
67
70
68
-
#### Usage example for int type:
71
+
#### Usage example for int type
72
+
69
73
```typescript
70
74
overridemapFromDriverValue(value: number|string): number {
71
75
if (typeofvalue==='string') {
@@ -76,6 +80,7 @@ override mapFromDriverValue(value: number | string): number {
This type is available only with extensions and used for example, just to show how you could setup any data type you want. Extension support will come soon
177
+
This type is available only with extensions and used for example, just to show how you could setup any data type you want. Extension support will come soon
0 commit comments