import { CharacterArg, TextType } from '..' import { AnyExpression, Expression } from '../../expressions' import { ConstraintConfig } from '../../functions' import { sql } from '../../template' import { Type, type } from '../index' import { IntervalArg, IntervalType } from './interval' export const TIMESTAMP = (precission?: number) => type`TIMESTAMP${precission ? sql`(${precission})` : sql``}` as TimestampType export type TimestampTypeArg = TimestampType['argument'] export interface TimestampType extends Type<'TIMESTAMP', R> { expression: TimestampExpression> argument: Expression | this['input'] required(conf?: ConstraintConfig): TimestampType } export const TIMESTAMPTZ = (precission?: number) => type`TIMESTAMPTZ${precission ? sql`(${precission})` : sql``}` as TimestamptzType export type TimestamptzTypeLiteral = TimestamptzType['input'] export type TimestamptzTypeArg = TimestamptzType['argument'] export interface TimestamptzType extends Type<'TIMESTAMPTZ', R> { expression: TimestampExpression> argument: Expression | this['input'] required(conf?: ConstraintConfig): TimestamptzType } export type TimestampTypes = TimestampType | TimestamptzType export type TimestampArg = TimestampTypes['argument'] export interface TimestampExpression extends AnyExpression { concat(arg: CharacterArg): Expression> add(arg: IntervalArg): TimestampExpression sub(arg: IntervalArg): TimestampExpression sub(arg: T['argument']): Expression> tz(arg: CharacterArg): TimestampExpression }