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.
return db.skins.get
.all()
.map(item => ({
name: item.Name,
creator: item.Creator,
}))toArray
Returns all matching skins in a regular array.
return db.skins.get
.toArray()
.map(item => ({
name: item.Name,
creator: item.Creator,
}))first
Returns the first matching skin, or undefined.
return db.skins.get
.first()?.Namecount
Counts all matching skins, even when a limit is set.
return db.skins.get
.count()limit
Limits how many skins elements are accessed.
return db.skins.get
.limit(1)
.map(item => ({
name: item.Name,
creator: item.Creator,
}))sortedBy
Sorts skins by a database field.
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.
const session = db.skins.get
.limit(1)
.autoEdit()
const length = session.length
session.rollback()
return lengthcommit
Saves the pending changes.
const session = db.skins.get
.limit(1)
.autoEdit()
const length = session.length
session.commit()
return lengthrollback
Discards the pending changes.
const session = db.skins.get
.limit(1)
.autoEdit()
const length = session.length
session.rollback()
return lengthwrite.delete
Deletes every matching skin in one transaction.
return db.skins.get
.limit(1)
.write.delete()write.update
Applies a typed patch to every matching skin.
return db.skins.get
.limit(1)
.write.update({ Name: 'Example' })builtIn
Returns the built-in skins in osu! order.
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.
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.
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.
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.
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.
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.
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.
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.
return db.skins.get
.byProtected(true)
.map(item => ({
name: item.Name,
creator: item.Creator,
}))usable
Returns skins that are available for use.
return db.skins.get
.usable()
.map(item => ({
name: item.Name,
creator: item.Creator,
}))user
Returns user-created skins that are not marked for deletion.
return db.skins.get
.user()
.map(item => ({
name: item.Name,
creator: item.Creator,
}))withFile
Finds skins related to the supplied file.
return db.skins.get
.withFile('cursor.png')
.map(item => ({
name: item.Name,
creator: item.Creator,
}))