GitHubEmpezar

Esta página aún no está traducida al español, por lo que se muestra la versión en inglés.

Más

records

github.com/nsgo-dev/game/pkg/online/records provides a server-authoritative JSON record boundary. Records are keyed by owner, collection and key, carry monotonically increasing versions and can be applied in one compare-and-set transaction. A record's Read permission decides who may Get and List it: Private records are read only by server code (reader records.Server), OwnerRead records also by their owner, and PublicRead records by anyone. Apply is server code and does not check Write; a player-facing service checks it before applying a player's write.

Store.Apply validates every expected version before mutating any record. Expected: 0 requires a new record, a positive expected version performs a conditional update, and AnyVersion (-1) matches whatever is stored. A conflict returns ErrChanged and leaves the whole transaction unchanged. A transaction that names a record twice, or has a record without an owner, collection or key, a value that is not JSON or an expected version below -1, is refused with ErrInvalid. The in-memory core is intended for persistent SQLite/Postgres adapters and wallet or match-result transactions.

Use records for state server code validates, such as an economy, progression or match results; keep private opaque client state, which the server never reads, in cloud save.

Editar esta página