API Docs for:
Show:

GeneralFactory Class

general factory class

create instance of model

Methods

create

(
  • modelName
  • root
)
FactoryInterface static

create a factory. If specific factory is defined, return the instance. Otherwise, return instance of GeneralFactory. This method is not suitable for creating collections, thus only called by Repository, which handles Entity (= non-collection).

Parameters:

Returns:

createCollection

(
  • collModelName
  • val
  • [options]
)
BaseDict private

create collection

Parameters:

  • collModelName String

    model name of collection

  • val Any
  • [options] Object optional

Returns:

BaseDict:

dict

createDict

(
  • dictModelName
  • val
  • [options]
)
BaseDict public

create model dict

Parameters:

  • dictModelName String

    model name of dict

  • val Any
  • [options] Object optional
    • [include] Object optional

      options to pass to Includer

      • [async=false] Object optional
        include sub-entities asynchronously if true.
      • [props] Array(String) optional
        include sub-entities of given props

Returns:

BaseDict:

dict

createEmpty

() BaseModel public

create empty model instance

Returns:

createFromObject

(
  • obj
  • [options={}]
)
BaseModel public

create instance of model class by plain object

for each prop, values are set by Model#set(prop, value)

Parameters:

  • obj Object
  • [options={}] Object optional
    • [include] Object optional

      options to pass to Includer

      • [async=false] Object optional
        include sub-entities asynchronously if true.
      • [props] Array(String) optional
        include sub-entities of given props

Returns:

BaseModel:

model

createList

(
  • listModelName
  • val
  • [options]
)
BaseList public

create model list

Parameters:

  • listModelName String

    model name of list

  • val Any
  • [options] Object optional
    • [include] Object optional

      options to pass to Includer

      • [async=false] Object optional
        include sub-entities asynchronously if true.
      • [props] Array(String) optional
        include sub-entities of given props

Returns:

BaseList:

list

createModel

(
  • modelName
  • obj
  • [options]
  • root
)
BaseModel

create an instance of the given modelName using obj if obj is null, return null if obj is undefined, empty object is created.

Parameters:

  • modelName String
  • obj Object
  • [options] Object optional
    • [include] Object optional

      options to pass to Includer

      • [async=false] Object optional
        include sub-entities asynchronously if true.
      • [props] Array(String) optional
        include sub-entities of given props
  • root RootInterface

Returns:

getModelClass

() Function

get model class this factory handles

Returns:

Function:

include

(
  • model
  • [includeOptions]
)
private

include submodels

Parameters:

  • model BaseModel
  • [includeOptions] Object optional
    • [async=false] Object optional

      include submodels asynchronously

    • [props] Array(String) optional

      include submodels of given props