Skip to content

Types ​

Every type below is exported from src/types.luau; the ones marked with a star are re-exported from the main module.

luau
local dataforge = require "@dataforge"
type Profile<T> = dataforge.Profile<T>

Configuration ​

Config<T> ★ ​

See Store config.

ResolvedConfig<T> ​

Config<T> with every optional field filled in. Available as store.config and profile.config.

TransactionConfig ★ ​

See TransactionConfig.

Migration ★ ​

luau
type Migration = {
	name: string,
	apply: (data: unknown) -> unknown,
}

Predicate<T> ​

luau
type Predicate<T> = (data: T?, key: string) -> boolean

Gate on a key's raw stored data. See Predicate.

Storage ​

Hook, DatastoreHandle, Scheduler ​

Backends for running outside Roblox. See Hooks.

DataRecord<T>, Lock, Pending<T> ​

What is stored under each key. See Stored shapes.

Profiles ​

ProfileBase<T> ★ ​

Shared shape of both profile kinds. See ProfileBase.

Profile<T> ★ ​

Session-locked profile. See Profile.

LocklessProfile<T> ★ ​

Lockless profile. See LocklessProfile.

PeekProfile<T> ★ ​

Read-only snapshot. See PeekProfile.

DataDispatcher<T> ★ ​

luau
type DataDispatcher<T> = (T) -> (T | false)?

The transform passed to update. Returns the new data, or nil / false to leave it untouched.

Transactions ​

TxContext ★ ​

See TxContext.

TxOutcome ​

luau
type TxOutcome = "committed" | "aborted"

Store ​

Store<T> ★ ​

See Store.

Errors ​

Result<T> ★ ​

luau
type Result<T> = Ok<T> | Err
type Ok<T> = { success: true, value: T, unwrap: (self) -> T }
type Err = { success: false, error: Error, unwrap: (self) -> never }

What every fallible call returns. See Errors.

Error ★ ​

Union of every error table (RobloxError, TimeoutError, LockLostError, ReleasedError, LocklessLockedError, TxLockLostError, OutdatedError, PredicateFailedError, NotFetchedError, ProfileClosedError, MigrationMismatchError, TxAbortedError, TxMarkerInvalidError, StoreClosedError, AlreadyLoadedError), each with a literal type. See Errors.