Skip to content

Commit 7698f70

Browse files
kistzbfops
andauthored
Make Uuid Nameable (#4011)
# Description of Changes Implements the `Nameable` interface for the generated uuid client bindings. # API and ABI breaking changes None. # Expected complexity level and risk 1. Only additive changes pretty much copy pasted from the other types where it was already implemented. # Testing - [x] Before it didnt work in my project now it works --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
1 parent 14b346c commit 7698f70

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

crates/bindings-typescript/src/lib/type_builders.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,8 @@ export class UuidBuilder
20052005
Indexable<Uuid, UuidAlgebraicType>,
20062006
Uniqueable<Uuid, UuidAlgebraicType>,
20072007
PrimaryKeyable<Uuid, UuidAlgebraicType>,
2008-
Defaultable<Uuid, UuidAlgebraicType>
2008+
Defaultable<Uuid, UuidAlgebraicType>,
2009+
Nameable<Uuid, UuidAlgebraicType>
20092010
{
20102011
constructor() {
20112012
super(Uuid.getAlgebraicType());
@@ -2052,6 +2053,11 @@ export class UuidBuilder
20522053
set(defaultMetadata, { defaultValue: value })
20532054
);
20542055
}
2056+
name<const Name extends string>(
2057+
name: Name
2058+
): UuidColumnBuilder<SetField<DefaultMetadata, 'name', Name>> {
2059+
return new UuidColumnBuilder(this, set(defaultMetadata, { name }));
2060+
}
20552061
}
20562062

20572063
/**
@@ -3536,7 +3542,8 @@ export class UuidColumnBuilder<M extends ColumnMetadata<Uuid> = DefaultMetadata>
35363542
Indexable<Uuid, UuidAlgebraicType>,
35373543
Uniqueable<Uuid, UuidAlgebraicType>,
35383544
PrimaryKeyable<Uuid, UuidAlgebraicType>,
3539-
Defaultable<Uuid, UuidAlgebraicType>
3545+
Defaultable<Uuid, UuidAlgebraicType>,
3546+
Nameable<Uuid, UuidAlgebraicType>
35403547
{
35413548
index(): UuidColumnBuilder<SetField<M, 'indexType', 'btree'>>;
35423549
index<N extends NonNullable<IndexTypes>>(
@@ -3568,6 +3575,14 @@ export class UuidColumnBuilder<M extends ColumnMetadata<Uuid> = DefaultMetadata>
35683575
set(this.columnMetadata, { defaultValue: value })
35693576
);
35703577
}
3578+
name<const Name extends string>(
3579+
name: Name
3580+
): UuidColumnBuilder<SetField<M, 'name', Name>> {
3581+
return new UuidColumnBuilder(
3582+
this.typeBuilder,
3583+
set(this.columnMetadata, { name })
3584+
);
3585+
}
35713586
}
35723587

35733588
export class RefBuilder<Type, SpacetimeType> extends TypeBuilder<

0 commit comments

Comments
 (0)