import { CharacterArg, TextType } from '..' import { AnyExpression, Expression } from '../../expressions' import { ConstraintConfig } from '../../functions' import { sql } from '../../template' import { Type, type } from '../index' import { DateArg } from './date' import { IntervalArg, IntervalType } from './interval' import { TimestampType } from './timestamp' export const TIME = (precission?: number) => type`TIME${precission ? sql`(${precission})` : sql``}` as TimeType export type TimeTypeLiteral = TimeType['input'] export type TimeTypeArg = TimeType['argument'] export interface TimeType extends Type<'TIME', R> { expression: TimeExpression> argument: Expression | this['input'] required(conf?: ConstraintConfig): TimeType } export const TIMETZ = (precission?: number) => type`TIMETZ${precission ? sql`(${precission})` : sql``}` as TimetzType export type TimetzTypeLiteral = TimeType['input'] export type TimetzTypeArg = TimeType['argument'] export interface TimetzType extends Type<'TIMETZ', R> { expression: TimeExpression> argument: Expression | this['input'] required(conf?: ConstraintConfig): TimetzType } export type TimeTypes = TimeType | TimetzType export type TimeLiteral = TimeTypes['input'] export type TimeArg = TimeTypes['argument'] export interface TimeExpression extends AnyExpression { concat(arg: CharacterArg): Expression> add(arg: DateArg): Expression> add(arg: IntervalArg): TimeExpression sub(arg: TimeArg): Expression> sub(arg: IntervalArg): TimeExpression tz(arg: CharacterArg): TimeExpression> }