Schema overview
An extension to the Effect.Schema
module that adds Schema instances for number and date formatting and parsing and implements new brands
Table of contents
Schema instances
DateTimeFromSelf
A Schema
that represents a CVDateTime
Signature
export declare const DateTimeFromSelf: Schema.declare<CVDateTime.Type, CVDateTime.Type, readonly [], never>
EmailFromSelf
A Schema
that represents a CVEmail
Signature
export declare const EmailFromSelf: Schema.Schema<CVEmail.Type, CVEmail.Type, never>
IntegerFromSelf
A Schema
that represents a CVInteger
Signature
export declare const IntegerFromSelf: Schema.Schema<
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId>,
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId>,
never
>
PositiveIntegerFromSelf
A Schema
that represents a CVPositiveInteger
Signature
export declare const PositiveIntegerFromSelf: Schema.Schema<
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId> & Brand<typeof _TypeId>,
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId> & Brand<typeof _TypeId>,
never
>
PositiveRealFromSelf
A Schema
that represents a CVPositiveReal
Signature
export declare const PositiveRealFromSelf: Schema.Schema<
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId>,
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId>,
never
>
RealFromSelf
A Schema
that represents CVReal
Signature
export declare const RealFromSelf: Schema.Schema<CVReal.Type, CVReal.Type, never>
SemVerFromSelf
A Schema
that represents a CVSemVer
Signature
export declare const SemVerFromSelf: Schema.Schema<CVSemVer.Type, CVSemVer.Type, never>
Schema transformations
BigDecimal
A Schema
that transforms a string into a BigDecimal
according to format
. Read documentation of module NumberBase10Format.ts for more details
Signature
export declare const BigDecimal: (format: CVNumberBase10Format.Type) => Schema.Schema<BigDecimal.BigDecimal, string>
Date
A Schema
that transforms a string into a Javascript Date
according to format
. Read documentation of module DateTimeFormat.ts for more details
Signature
export declare const Date: (format: CVDateTimeFormat.Type) => Schema.Schema<Date, string>
DateFromDateTime
A Schema
that transforms a CVDateTime
into a Javascript Date
. Upon encoding, the CVDateTime
object is created with the default timeZoneOffset of the machine this code is running on
Signature
export declare const DateFromDateTime: Schema.Schema<Date, CVDateTime.Type, never>
DateTime
A Schema
that transforms a string into a CVDateTime
according to format
. Read documentation of module DateTimeFormat.ts for more details
Signature
export declare const DateTime: (format: CVDateTimeFormat.Type) => Schema.Schema<CVDateTime.Type, string>
DateTimeZoned
A Schema
that transforms a string into an Effect.DateTime.Zoned
according to format
. Read documentation of module DateTimeFormat.ts for more details
Signature
export declare const DateTimeZoned: (format: CVDateTimeFormat.Type) => Schema.Schema<DateTime.Zoned, string>
DateTimeZonedFromDateTime
A Schema
that transforms a CVDateTime
into an Effect.DateTime.Zoned
. Both objects share the same time zone offset
Signature
export declare const DateTimeZonedFromDateTime: Schema.Schema<DateTime.Zoned, CVDateTime.Type, never>
A Schema
that transforms a string into a CVEmail
Signature
export declare const Email: Schema.Schema<CVEmail.Type, string, never>
IntegerFromNumber
A Schema
that transforms a number into a CVInteger
Signature
export declare const IntegerFromNumber: Schema.Schema<
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId>,
number,
never
>
PositiveIntegerFromNumber
A Schema
that transforms a number into a CVPositiveInteger
Signature
export declare const PositiveIntegerFromNumber: Schema.Schema<
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId> & Brand<typeof _TypeId>,
number,
never
>
PositiveRealFromNumber
A Schema
that transforms a number into a CVPositiveReal
Signature
export declare const PositiveRealFromNumber: Schema.Schema<
number & Brand<typeof CVReal.TypeId> & Brand<typeof _TypeId>,
number,
never
>
Real
A Schema
that transforms a string into a CVReal
according to the format
. Read documentation of module NumberBase10Format.ts for more details
Signature
export declare const Real: (format: CVNumberBase10Format.Type) => Schema.Schema<CVReal.Type, string>
RealFromNumber
A Schema
that transforms a number into a CVReal
Signature
export declare const RealFromNumber: Schema.Schema<CVReal.Type, number, never>
SemVer
A Schema
that transforms a string into a CVSemVer
Signature
export declare const SemVer: Schema.Schema<CVSemVer.Type, string, never>
Template
A Schema
that transforms a string into an object according to template. Read documentation of module Template.ts for more details
Signature
export declare const Template: <const PS extends CVTemplateParts.Type>(
template: CVTemplate.Type<PS>
) => Schema.Schema<
{
readonly [k in keyof MTypes.ArrayKeys<PS> as PS[k] extends CVTemplatePlaceholder.All
? CVTemplatePlaceholder.ExtractName<PS[k]>
: never]: PS[k] extends CVTemplatePlaceholder.All ? CVTemplatePlaceholder.ExtractType<PS[k]> : never
},
string
>