Builder Class
Packages > @anticrm/model > Builder
Signature:
declare class Builder
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(memdb) | Constructs a new instance of the Builder class |
Methods
Method | Modifiers | Description |
---|---|---|
add(classes) | ||
createDocument(_class, values, _id) | ||
dump() | ||
dumpAll() | ||
getDomain(domain) | ||
load(model) | ||
mixin(id, clazz, values) | ||
mixinDocument(doc, clazz, values) |
Constructors
Builder.(constructor)
Constructs a new instance of the Builder
class
Signature:
constructor(memdb?: Model);
Parameters
Parameter | Type | Description |
---|---|---|
memdb | Model |
Methods
add
Signature:
add(...classes: Array<new () => Obj>): void;
Parameters
Parameter | Type | Description |
---|---|---|
classes | Array |
Returns:
void
createDocument
Signature:
createDocument<M extends Doc>(_class: Ref<Class<M>>, values: DocumentValue<M>, _id?: Ref<M>): M;
Parameters
Parameter | Type | Description |
---|---|---|
_class | Ref<Class |
|
values | DocumentValue |
|
_id | Ref |
Returns:
M
dump
Signature:
dump(): Doc[];
Returns:
Doc[]
dumpAll
Signature:
dumpAll(): {
[key: string]: Doc[];
};
Returns:
{ [key: string]: Doc[]; }
getDomain
Signature:
getDomain(domain: string): Model;
Parameters
Parameter | Type | Description |
---|---|---|
domain | string |
Returns:
load
Signature:
load(model: (builder: Builder) => void): void;
Parameters
Parameter | Type | Description |
---|---|---|
model | (builder: Builder) => void |
Returns:
void
mixin
Signature:
mixin<T extends E, E extends Doc>(id: Ref<E>, clazz: Ref<Mixin<T>>, values: Omit<T, keyof E>): void;
Parameters
Parameter | Type | Description |
---|---|---|
id | Ref |
|
clazz | Ref<Mixin |
|
values | Omit |
Returns:
void
mixinDocument
Signature:
mixinDocument<T extends E, E extends Doc>(doc: E, clazz: Ref<Mixin<T>>, values: Omit<T, keyof E>): void;
Parameters
Parameter | Type | Description |
---|---|---|
doc | E | |
clazz | Ref<Mixin |
|
values | Omit |
Returns:
void