-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add default value checks * add comments for editor intelisense
- Loading branch information
1 parent
f4e94a1
commit 04e17c1
Showing
19 changed files
with
394 additions
and
221 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
import { type ClickhouseSchema } from '@clickhouse-schema-core/clickhouse_schema' | ||
import { type ChArray } from '@clickhouse-schema-data-types/ch_array' | ||
import { type ChJSON } from '@clickhouse-schema-data-types/ch_json' | ||
import { type ChEnum, type ChLowCardinality } from '@clickhouse-schema-data-types/ch_low_ cardinality' | ||
import { type ChNullable } from '@clickhouse-schema-data-types/ch_nullable' | ||
import { type ChDataType } from '@clickhouse-schema-data-types/index' | ||
import { type InferTypeFromMap } from '@clickhouse-schema-utils/util' | ||
|
||
/** InferSchemaClickhouseSchemaType is a type that takes a ClickhouseSchema and returns the typescript that it represents */ | ||
export type InferClickhouseSchemaType<T extends ClickhouseSchema<any>> = { [K in keyof T['schema']]: InferType<T['schema'][K]['type']> } | ||
/** Infer is a type that takes a ChDataType and returns the typescript that it represents */ | ||
type Infer<T extends ChDataType> = T['typeScriptType'] | ||
|
||
/** InferType is a type that takes a ChDataType and returns the typescript that it represents */ | ||
export type InferType<T extends ChDataType> = | ||
T extends ChNullable<infer NullableType> | ||
? InferTypeFromMap<NullableType['typeStr']> | null | ||
: T extends ChArray<infer ArrayType> | ||
? Array<InferType<ArrayType>> | ||
: T extends ChEnum<infer EnumType> | ||
? keyof EnumType | ||
: T extends ChJSON<infer Schema> | ||
? { [K in keyof Schema]: InferType<Schema[K]['type']> } | ||
: T extends ChLowCardinality<infer LowCardinalityType> | ||
? InferTypeFromMap<LowCardinalityType['typeStr']> | ||
: InferTypeFromMap<T['typeStr']> | ||
/** InferSchemaClickhouseSchemaType is a type that takes a ClickhouseSchema and returns the typescript that it represents */ | ||
export type InferClickhouseSchemaType<T extends ClickhouseSchema<any>> = { [K in keyof T['schema']]: Infer<T['schema'][K]['type']> } |
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
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
Oops, something went wrong.
04e17c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
25 tests passing in 2 suites.
Report generated by 🧪jest coverage report action from 04e17c1