# Class default

Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple parents.

Note that you should not rely on the branch's identity, since it can change easily with a note's move. Always check noteId instead.

#### Hierarchy (View Summary)

- default<default>
  - default

- Defined in becca/entities/bbranch.ts:20

#####
Index

### Constructors

constructor

### Properties

blobId?
branchId?
dateCreated?
dateModified?
isExpanded
isProtected?
isSynced?
noteId
notePosition
parentNoteId
prefix
utcDateCreated
utcDateModified?

### Accessors

becca
childNote
isDeleted
isWeak
parentNote
entityName
hashedProperties
primaryKeyName

### Methods

_getContent
_setContent
beforeSaving
createClone
deleteBranch
generateHash
getNote
getPojo
getPojoToSave
getUtcDateChanged
hasStringContent
init
markAsDeleted
markAsDeletedSimple
putEntityChange
save
update
updateFromRow

##
Constructors

### constructor

- new default(row?: BranchRow): default

- #### Parameters

  - `Optional` row: BranchRow

  #### Returns default

  Overrides default.constructor

  - Defined in becca/entities/bbranch.ts:33

##
Properties

### `Optional` blobId

blobId?: string

Inherited from default.blobId

- Defined in becca/entities/abstract_becca_entity.ts:35

### `Optional` branchId

branchId?: string

- Defined in becca/entities/bbranch.ts:26

### `Optional` dateCreated

dateCreated?: string

Inherited from default.dateCreated

- Defined in becca/entities/abstract_becca_entity.ts:28

### `Optional` dateModified

dateModified?: string

Inherited from default.dateModified

- Defined in becca/entities/abstract_becca_entity.ts:29

### isExpanded

isExpanded: boolean

- Defined in becca/entities/bbranch.ts:31

### `Optional` isProtected

isProtected?: boolean

Inherited from default.isProtected

- Defined in becca/entities/abstract_becca_entity.ts:33

### `Optional` isSynced

isSynced?: boolean

Inherited from default.isSynced

- Defined in becca/entities/abstract_becca_entity.ts:34

### noteId

noteId: string

- Defined in becca/entities/bbranch.ts:27

### notePosition

notePosition: number

- Defined in becca/entities/bbranch.ts:30

### parentNoteId

parentNoteId: string

- Defined in becca/entities/bbranch.ts:28

### prefix

prefix: null | string

- Defined in becca/entities/bbranch.ts:29

### utcDateCreated

utcDateCreated: string

Inherited from default.utcDateCreated

- Defined in becca/entities/abstract_becca_entity.ts:31

### `Optional` utcDateModified

utcDateModified?: string

Inherited from default.utcDateModified

- Defined in becca/entities/abstract_becca_entity.ts:27

##
Accessors

### `Protected` becca

- get becca(): Becca

- #### Returns Becca

  Inherited from AbstractBeccaEntity.becca

  - Defined in becca/entities/abstract_becca_entity.ts:48

### childNote

- get childNote(): default

- #### Returns default

  - Defined in becca/entities/bbranch.ts:97

### isDeleted

- get isDeleted(): boolean

- #### Returns boolean

  Overrides AbstractBeccaEntity.isDeleted

  - Defined in becca/entities/bbranch.ts:120

### isWeak

- get isWeak(): boolean

- Branch is weak when its existence should not hinder deletion of its note. As a result, note with only weak branches should be immediately deleted. An example is shared or bookmarked clones - they are created automatically and exist for technical reasons, not as user-intended actions. From user perspective, they don't count as real clones and for the purpose of deletion should not act as a clone.

  #### Returns boolean

  - Defined in becca/entities/bbranch.ts:131

### parentNote

- get parentNote(): undefined | default

- #### Returns undefined | default

  root branch will have undefined parent, all other branches have to have a parent note

  - Defined in becca/entities/bbranch.ts:111

### `Static` entityName

- get entityName(): string

- #### Returns string

  - Defined in becca/entities/bbranch.ts:21

### `Static` hashedProperties

- get hashedProperties(): string[]

- #### Returns string[]

  - Defined in becca/entities/bbranch.ts:24

### `Static` primaryKeyName

- get primaryKeyName(): string

- #### Returns string

  - Defined in becca/entities/bbranch.ts:22

##
Methods

### `Protected`_getContent

- _getContent(): string | Buffer<ArrayBufferLike>

- #### Returns string | Buffer<ArrayBufferLike>

  Inherited from default._getContent

  - Defined in becca/entities/abstract_becca_entity.ts:264

### `Protected`_setContent

- _setContent(content: string | Buffer<ArrayBufferLike>, opts?: ContentOpts): void

- #### Parameters

  - content: string | Buffer<ArrayBufferLike>
  - opts: ContentOpts = {}

  #### Returns void

  Inherited from default._setContent

  - Defined in becca/entities/abstract_becca_entity.ts:141

### beforeSaving

- beforeSaving(): void

- #### Returns void

  Overrides default.beforeSaving

  - Defined in becca/entities/bbranch.ts:212

### createClone

- createClone(parentNoteId: string, notePosition?: number): default

- #### Parameters

  - parentNoteId: string
  - `Optional` notePosition: number

  #### Returns default

  - Defined in becca/entities/bbranch.ts:267

### deleteBranch

- deleteBranch(deleteId?: string, taskContext?: TaskContext): boolean

- Delete a branch. If this is a last note's branch, delete the note as well.

  #### Parameters

  - `Optional` deleteId: string

    optional delete identified

  - `Optional` taskContext: TaskContext

  #### Returns boolean

  true if note has been deleted, false otherwise

  - Defined in becca/entities/bbranch.ts:142

### generateHash

- generateHash(isDeleted?: boolean): string

- #### Parameters

  - `Optional` isDeleted: boolean

  #### Returns string

  Inherited from default.generateHash

  - Defined in becca/entities/abstract_becca_entity.ts:64

### getNote

- getNote(): default

- #### Returns default

  - Defined in becca/entities/bbranch.ts:106

### getPojo

- getPojo(): {
  branchId: undefined
  | string;
  isDeleted: boolean;
  isExpanded: boolean;
  noteId: string;
  notePosition: number;
  parentNoteId: string;
  prefix: null | string;
  utcDateModified: undefined | string;
  }

- #### Returns {
  branchId: undefined | string;
  isDeleted: boolean;
  isExpanded: boolean;
  noteId: string;
  notePosition: number;
  parentNoteId: string;
  prefix: null | string;
  utcDateModified: undefined | string;
  }

  Overrides default.getPojo

  - Defined in becca/entities/bbranch.ts:254

### `Protected` getPojoToSave

- getPojoToSave(): {}

- #### Returns {}

  Inherited from default.getPojoToSave

  - Defined in becca/entities/abstract_becca_entity.ts:79

### getUtcDateChanged

- getUtcDateChanged(): string

- #### Returns string

  Inherited from default.getUtcDateChanged

  - Defined in becca/entities/abstract_becca_entity.ts:44

### hasStringContent

- hasStringContent(): boolean

- #### Returns boolean

  Inherited from default.hasStringContent

  - Defined in becca/entities/abstract_becca_entity.ts:83

### init

- init(): void

- #### Returns void

  Overrides default.init

  - Defined in becca/entities/bbranch.ts:68

### markAsDeleted

- markAsDeleted(deleteId?: null | string): void

- Mark the entity as (soft) deleted. It will be completely erased later.

  This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead.

  #### Parameters

  - deleteId: null | string = null

  #### Returns void

  Inherited from default.markAsDeleted

  - Defined in becca/entities/abstract_becca_entity.ts:280

### markAsDeletedSimple

- markAsDeletedSimple(): void

- #### Returns void

  Inherited from default.markAsDeletedSimple

  - Defined in becca/entities/abstract_becca_entity.ts:305

### `Protected` putEntityChange

- putEntityChange(isDeleted: boolean): void

- #### Parameters

  - isDeleted: boolean

  #### Returns void

  Inherited from default.putEntityChange

  - Defined in becca/entities/abstract_becca_entity.ts:52

### save

- save(opts?: {}): this

- Saves entity - executes SQL, but doesn't commit the transaction on its own

  #### Parameters

  - `Optional` opts: {}

  #### Returns this

  Inherited from default.save

  - Defined in becca/entities/abstract_becca_entity.ts:104

### update

- update(__namedParameters: any): default

- #### Parameters

  - __namedParameters: any

  #### Returns default

  - Defined in becca/entities/bbranch.ts:56

### updateFromRow

- updateFromRow(row: BranchRow): void

- #### Parameters

  - row: BranchRow

  #### Returns void

  Overrides default.updateFromRow

  - Defined in becca/entities/bbranch.ts:44