-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for Postgres enums
This allows pgtyped to generate code from queries involving database enum types. The postgres enums will be converted to a string-valued const enum in the generated code. The `getTypes` reflection query now joins on pg_enum and accumulates enum information as it collects other type information. I think it may be possible to accomodate composite types by aggregating over the object graph given by a suitable join query in a similar way. @pgtyped/query now returns `MappableTypes` which are either a string referencing a database type name or a fully-described `Type`. `Type` now includes `EnumType`. This allows type definitions to be realised at different stages in the reflection/mapping process and should allow for custom overries in config. Signed-off-by: Silas Davis <silas@monax.io>
- Loading branch information
Silas Davis
committed
May 6, 2020
1 parent
d38230b
commit e651302
Showing
19 changed files
with
696 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { DefaultTypeMapping, TypeAllocator } from './types'; | ||
|
||
describe('TypeAllocator', () => { | ||
test('Allows overrides', () => { | ||
const types = new TypeAllocator({ | ||
...DefaultTypeMapping, | ||
foo: { name: 'bar' }, | ||
}); | ||
expect(types.use('foo')).toEqual('bar'); | ||
}); | ||
}); |
Oops, something went wrong.