Skip to content

routier-collection


routier-collection / core/src / SchemaNumber

Class: SchemaNumber<T, TModifiers> ​

Defined in: core/src/schema/property/types/SchemaNumber.ts:18

Extends ​

Type Parameters ​

T ​

T extends number

TModifiers ​

TModifiers extends SchemaModifiers

Constructors ​

Constructor ​

new SchemaNumber<T, TModifiers>(entity?, literals?): SchemaNumber<T, TModifiers>

Defined in: core/src/schema/property/base/SchemaBase.ts:75

Parameters ​

entity? ​

SchemaBase<T, TModifiers>

literals? ​

T[]

Returns ​

SchemaNumber<T, TModifiers>

Inherited from ​

SchemaBase.constructor

Properties ​

modifiers ​

modifiers: TModifiers

Defined in: core/src/schema/property/base/SchemaBase.ts:6

Inherited from ​

SchemaBase.modifiers


isNullable ​

isNullable: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:8

Inherited from ​

SchemaBase.isNullable


isUnmapped ​

isUnmapped: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:9

Inherited from ​

SchemaBase.isUnmapped


isOptional ​

isOptional: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:10

Inherited from ​

SchemaBase.isOptional


isKey ​

isKey: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:11

Inherited from ​

SchemaBase.isKey


isIdentity ​

isIdentity: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:12

Inherited from ​

SchemaBase.isIdentity


isReadonly ​

isReadonly: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:13

Inherited from ​

SchemaBase.isReadonly


isDistinct ​

isDistinct: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:14

Inherited from ​

SchemaBase.isDistinct


transform ​

transform: PropertyTransform<unknown> = null

Defined in: core/src/schema/property/base/SchemaBase.ts:19

Set by .modify(x => x.transform(...)). A live reference, never stringified. null when the property is stored as it is.

Inherited from ​

SchemaBase.transform


indexes ​

indexes: string[] = []

Defined in: core/src/schema/property/base/SchemaBase.ts:20

Inherited from ​

SchemaBase.indexes


fromPropertyName ​

fromPropertyName: string = null

Defined in: core/src/schema/property/base/SchemaBase.ts:21

Inherited from ​

SchemaBase.fromPropertyName


dimensions ​

dimensions: number = null

Defined in: core/src/schema/property/base/SchemaBase.ts:35

How many numbers a vector holds. null for every other type.

Declared here rather than on SchemaVector because a modifier WRAPS rather than extends: s.vector(1536).optional() is a SchemaOptional, and anything reachable only through the original class is lost the moment a modifier is added. type survives for exactly this reason — the copy constructor below carries it — and a dimension count has to travel with it, or an optional vector reaches a backend as a vector of unknown width and cannot be given a column.

innerSchema is the cautionary example: it lives on SchemaArray alone, so a modified array arrives with no element type and clones through the slow path.

Inherited from ​

SchemaBase.dimensions


maxLength ​

maxLength: number = null

Defined in: core/src/schema/property/base/SchemaBase.ts:50

The longest string the property is declared to hold. null for every other type, and for a string that declares nothing.

Declared here rather than on SchemaString for the same reason as dimensions above: s.string({ maxLength: 4000 }).optional() is a SchemaOptional, so anything reachable only through SchemaString is lost the moment a modifier is added.

A declaration, never a validation. Core does not check a value against it and does not truncate. The backend that can use the number does: MySQL gives the column VARCHAR(maxLength) instead of the blanket VARCHAR(255). Every other backend ignores it, because a string column that is already unbounded cannot be made more correct by knowing a bound.

Inherited from ​

SchemaBase.maxLength


isSearchable ​

isSearchable: boolean = false

Defined in: core/src/schema/property/base/SchemaBase.ts:62

Whether this string may be tokenised into a full-text search index.

Set by .searchable(), and only ever true on a string. Eligibility, not membership: a collection that never declares .searchIndex() indexes nothing regardless.

Copied by the constructor below, so s.string().searchable().optional() stays searchable. Every flag on this class is copied for the same reason: a modifier WRAPS rather than extends, so anything the constructor forgets is silently dropped the moment a property gains one more modifier.

Inherited from ​

SchemaBase.isSearchable


foreignKeyDefinition ​

foreignKeyDefinition: ForeignKey<unknown> = null

Defined in: core/src/schema/property/base/SchemaBase.ts:64

Inherited from ​

SchemaBase.foreignKeyDefinition


tags ​

tags: string[] = []

Defined in: core/src/schema/property/base/SchemaBase.ts:65

Inherited from ​

SchemaBase.tags


injected ​

injected: any = null

Defined in: core/src/schema/property/base/SchemaBase.ts:66

Inherited from ​

SchemaBase.injected


defaultValue ​

defaultValue: DefaultValue<T> = null

Defined in: core/src/schema/property/base/SchemaBase.ts:67

Inherited from ​

SchemaBase.defaultValue


valueSerializer ​

valueSerializer: PropertySerializer<T> = null

Defined in: core/src/schema/property/base/SchemaBase.ts:68

Inherited from ​

SchemaBase.valueSerializer


valueDeserializer ​

valueDeserializer: PropertyDeserializer<T> = null

Defined in: core/src/schema/property/base/SchemaBase.ts:69

Inherited from ​

SchemaBase.valueDeserializer


functionBody ​

functionBody: FunctionBody<any, T>

Defined in: core/src/schema/property/base/SchemaBase.ts:71

Inherited from ​

SchemaBase.functionBody


literals ​

readonly literals: T[] = []

Defined in: core/src/schema/property/base/SchemaBase.ts:73

Inherited from ​

SchemaBase.literals


instance ​

instance: T

Defined in: core/src/schema/property/types/SchemaNumber.ts:20

Overrides ​

SchemaBase.instance


type ​

type: SchemaTypes = SchemaTypes.Number

Defined in: core/src/schema/property/types/SchemaNumber.ts:21

Overrides ​

SchemaBase.type

Methods ​

constrain() ​

constrain<K>(): SchemaNumber<K, TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:24

Type Parameters ​

K ​

K extends number

Returns ​

SchemaNumber<K, TModifiers>


from() ​

from(propertyName): SchemaFrom<T, TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:28

Parameters ​

propertyName ​

string

Returns ​

SchemaFrom<T, TModifiers>


optional() ​

optional(): SchemaOptional<T, "optional" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:32

Returns ​

SchemaOptional<T, "optional" | TModifiers>


nullable() ​

nullable(): SchemaNullable<T, "nullable" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:36

Returns ​

SchemaNullable<T, "nullable" | TModifiers>


key() ​

key(): SchemaKey<T, "key" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:40

Returns ​

SchemaKey<T, "key" | TModifiers>


foreignKey() ​

foreignKey<K>(relatingSchema, property): SchemaForeignKey<T, TModifiers, K>

Defined in: core/src/schema/property/types/SchemaNumber.ts:44

Type Parameters ​

K ​

K extends object

Parameters ​

relatingSchema ​

CompiledSchema<K>

property ​

keyof IsEmptyObject<{ [K in string | number | symbol as IsPlainProperty<K, K> extends true ? K : never]: InferPrimitive<K[K]> }> extends true ? object : { [K in string | number | symbol as IsPlainProperty<K, K> extends true ? K : never]: InferPrimitive<K[K]> } | keyof IsEmptyObject<{ readonly [K in string | number | symbol as HasModifier<K, K, "readonly"> extends true ? K : never]: InferPrimitive<K[K]> }> extends true ? object : { readonly [K in string | number | symbol as HasModifier<K, K, "readonly"> extends true ? K : never]: InferPrimitive<K[K]> } | keyof IsEmptyObject<{ [K in string | number | symbol as HasModifier<K, K, "optional"> extends true ? K : never]?: InferPrimitive<K[K]> }> extends true ? object : { [K in string | number | symbol as HasModifier<K, K, "optional"> extends true ? K : never]?: InferPrimitive<K[K]> } | keyof IsEmptyObject<{ [K in string | number | symbol as HasModifier<K, K, "nullable"> extends true ? K : never]: InferPrimitive<K[K]> }> extends true ? object : { [K in string | number | symbol as HasModifier<K, K, "nullable"> extends true ? K : never]: InferPrimitive<K[K]> }

Returns ​

SchemaForeignKey<T, TModifiers, K>


default() ​

default<I>(value, injected?): SchemaDefault<T, I, "default" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:48

Type Parameters ​

I ​

I = never

Parameters ​

value ​

DefaultValue<T, I>

injected? ​

I

Returns ​

SchemaDefault<T, I, "default" | TModifiers>


readonly() ​

readonly(): SchemaReadonly<T, "readonly" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:52

Returns ​

SchemaReadonly<T, "readonly" | TModifiers>


deserialize() ​

deserialize(deserializer): SchemaDeserialize<T, "deserialize" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:56

Parameters ​

deserializer ​

PropertyDeserializer<T>

Returns ​

SchemaDeserialize<T, "deserialize" | TModifiers>


serialize() ​

serialize(serializer): SchemaSerialize<T, "serialize" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:60

Parameters ​

serializer ​

PropertySerializer<T>

Returns ​

SchemaSerialize<T, "serialize" | TModifiers>


identity() ​

identity(): SchemaIdentity<T, "identity" | "readonly" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:64

Returns ​

SchemaIdentity<T, "identity" | "readonly" | TModifiers>


array() ​

array(): SchemaArray<SchemaNumber<T, TModifiers>, TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:68

Returns ​

SchemaArray<SchemaNumber<T, TModifiers>, TModifiers>


index() ​

index(...indexes): SchemaIndex<T, TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:72

Parameters ​

indexes ​

...string[]

Returns ​

SchemaIndex<T, TModifiers>


distinct() ​

distinct(): SchemaDistinct<T, "distinct" | TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:76

Returns ​

SchemaDistinct<T, "distinct" | TModifiers>


tag() ​

tag(...tags): SchemaTag<T, TModifiers>

Defined in: core/src/schema/property/types/SchemaNumber.ts:80

Parameters ​

tags ​

...string[]

Returns ​

SchemaTag<T, TModifiers>

Released under the MIT License.