Skip to content

Skins ​

db.skins.get returns read-only snapshots for skins. You can keep chaining filters or use normal array methods.

These examples use a small fixture that resets for every run. Your application still uses its own Realm database.

all ​

Returns all matching skins in a regular array.

ts
return db.skins.get
  .all()
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

toArray ​

Returns all matching skins in a regular array.

ts
return db.skins.get
  .toArray()
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

first ​

Returns the first matching skin, or undefined.

ts
return db.skins.get
  .first()?.Name

count ​

Counts all matching skins, even when a limit is set.

ts
return db.skins.get
  .count()

limit ​

Limits how many skins elements are accessed.

ts
return db.skins.get
  .limit(1)
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

sortedBy ​

Sorts skins by a database field.

ts
return db.skins.get
  .sortedBy('Name')
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

autoEdit ​

Starts an edit session that buffers changes to matching skins. Commit or roll them back when you are done.

ts
const session = db.skins.get
  .limit(1)
  .autoEdit()
const length = session.length
session.rollback()
return length

commit ​

Saves the pending changes.

ts
const session = db.skins.get
  .limit(1)
  .autoEdit()
const length = session.length
session.commit()
return length

rollback ​

Discards the pending changes.

ts
const session = db.skins.get
  .limit(1)
  .autoEdit()
const length = session.length
session.rollback()
return length

write.delete ​

Deletes every matching skin in one transaction.

ts
return db.skins.get
  .limit(1)
  .write.delete()

write.update ​

Applies a typed patch to every matching skin.

ts
return db.skins.get
  .limit(1)
  .write.update({ Name: 'Example' })

builtIn ​

Returns the built-in skins in osu! order.

ts
return db.skins.get
  .builtIn()
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byCreatorContains ​

Finds skins where creator contains the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byCreatorContains('cyperdark')
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byDeletePending ​

Finds skins where delete pending matches the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byDeletePending(true)
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byHash ​

Finds skins where hash matches the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byHash('a'.repeat(64))
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byId ​

Finds skins where ID matches the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byId('88888888-8888-4888-8888-888888888888')
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byInstantiationInfoContains ​

Finds skins where instantiation info contains the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byInstantiationInfoContains('osu.Game')
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byName ​

Finds skins where name matches the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byName('WhiteCat')
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byNameContains ​

Finds skins where name contains the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byNameContains('White')
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

byProtected ​

Finds skins where protected matches the supplied value. You can chain more filters on the result.

ts
return db.skins.get
  .byProtected(true)
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

usable ​

Returns skins that are available for use.

ts
return db.skins.get
  .usable()
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

user ​

Returns user-created skins that are not marked for deletion.

ts
return db.skins.get
  .user()
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

withFile ​

Finds skins related to the supplied file.

ts
return db.skins.get
  .withFile('cursor.png')
  .map(item => ({
    name: item.Name,
    creator: item.Creator,
  }))

Released under the MIT License.