Builder Class

Packages > @anticrm/model > Builder

Signature:

declare class Builder 

Constructors

List of constructors for this class
Constructor Modifiers Description
(constructor)(memdb) Constructs a new instance of the Builder class

Methods

List of methods on this class
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

List of parameters
Parameter Type Description
memdb Model

Methods

add

Signature:

add(...classes: Array<new () => Obj>): void;

Parameters

List of parameters
Parameter Type Description
classes Array Obj>

Returns:

void

createDocument

Signature:

createDocument<M extends Doc>(_class: Ref<Class<M>>, values: DocumentValue<M>, _id?: Ref<M>): M;

Parameters

List of 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

List of parameters
Parameter Type Description
domain string

Returns:

Model

load

Signature:

load(model: (builder: Builder) => void): void;

Parameters

List of 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

List of 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

List of parameters
Parameter Type Description
doc E
clazz Ref<Mixin>
values Omit

Returns:

void