Skip to content

Class: EditSession<T> ​

Defined in: src/edit-session.ts:28

Keeps edits in memory until you commit or dispose of the session.

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

using session = db.beatmaps.get.byAuthorContains('Monstrata').autoEdit()
for (const beatmap of session)
  beatmap.Metadata!.Author!.Username = 'Sotarks'
// Commits here and records rollback entries.

Type Parameters ​

Type Parameter
T

Implements ​

  • Iterable<T>

Constructors ​

new EditSession<T>(realm, objects, options?): EditSession<T>

Defined in: src/edit-session.ts:46

Creates an edit session for Realm objects.

You probably should call autoEdit() on a result instead of constructing it manually.

Parameters ​

ParameterType
realmRealm
objectsT[]
options?{ entity?: string; hooks?: RealmEditHooks; primaryKey?: string; }
options.entity?string
options.hooks?RealmEditHooks
options.primaryKey?string

Returns ​

EditSession<T>

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

const session = db.beatmaps.get.byBpmAbove(180).autoEdit()
for (const beatmap of session) beatmap.Hidden = true
session.commit()

Accessors ​

length ​

get length(): number

Defined in: src/edit-session.ts:64

Returns ​

number

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

const session = db.beatmaps.get.limit(1).autoEdit()
const length = session.length
session.rollback()

return length

Methods ​

[dispose]() ​

[dispose](): void

Defined in: src/edit-session.ts:160

Returns ​

void


[iterator]() ​

[iterator](): Iterator<T>

Defined in: src/edit-session.ts:60

Returns ​

Iterator<T>

Implementation of ​

Iterable.[iterator]


at() ​

at(index): T | undefined

Defined in: src/edit-session.ts:68

Parameters ​

ParameterType
indexnumber

Returns ​

T | undefined

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

const session = db.beatmaps.get.limit(1).autoEdit()
const length = session.length
session.rollback()

return length

commit() ​

commit(): void

Defined in: src/edit-session.ts:127

Returns ​

void

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

const session = db.beatmaps.get.limit(1).autoEdit()
const length = session.length
session.rollback()

return length

forEach() ​

forEach(callback): void

Defined in: src/edit-session.ts:72

Parameters ​

ParameterType
callback(value, index, array) => void

Returns ​

void

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

const session = db.beatmaps.get.limit(1).autoEdit()
const length = session.length
session.rollback()

return length

map() ​

map<U>(callback): U[]

Defined in: src/edit-session.ts:76

Type Parameters ​

Type Parameter
U

Parameters ​

ParameterType
callback(value, index, array) => U

Returns ​

U[]

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

const session = db.beatmaps.get.limit(1).autoEdit()
const length = session.length
session.rollback()

return length

rollback() ​

rollback(): void

Defined in: src/edit-session.ts:155

Returns ​

void

This example requires Node.js.

ts
import { EditSession } from 'osu-files'

const session = db.beatmaps.get.limit(1).autoEdit()
const length = session.length
session.rollback()

return length

Released under the MIT License.