Skip to content

docs(data): detached reads, null-id refusal, conditional update and delete() count, as of v6.3.0 - #104

Open
wisdommen wants to merge 5 commits into
alphafrom
docs/p17-fu-data
Open

wisdommen wants to merge 5 commits into
alphafrom
docs/p17-fu-data

Conversation

@wisdommen

@wisdommen wisdommen commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

This pull request targets alpha deliberately: it documents unreleased 6.3.0 behaviour, and alpha publishes to master together with the framework release. Companion to UltiKits/UltiTools-Reborn#559 (data layer: #520, #522, #521, #546, #543, #515, #558).

本 PR 有意指向 alpha(记录尚未发布的 6.3.0 行为);配套框架 PR UltiKits/UltiTools-Reborn#559。

What changes

docs/src/guide/essentials/data-storage.md and its zh mirror, section CRUD Operations:

  • Every entity a read returns is a copy and insert stores a copy: a change reaches the store only through update(...), on every backend (as of v6.3.0; before, the JSON backend saved it at the next flush).
  • update(T), update(column, value, id), delById and updateAll throw DataAccessException for a null id; rows 6.2.0 stored on SQLite without an id are given one at table initialisation (the id the entity reports, or a new UUID), and every write stores getId() in the id column.
  • An update by an id no row has writes nothing and warns; updateCounted(entity) returns 1/0 so the caller can tell (as of v6.3.0, #558).
  • New section Conditional Update (updateIf, v6.3.0+): what it returns, how the check and write stay together on MySQL/SQLite and on JSON, and when it throws.

docs/src/guide/essentials/query-dsl.md and its zh mirror: delete() returns the number of rows removed and refuses a matched null-id row before deleting anything (as of v6.3.0).

Constraints kept

  • Prose and inline code only; no new <<< @/../examples/... reference (the examples/ project compiles against the released 6.2.x, which has no updateIf).
  • No change to versionsConfig.current or examples/pom.xml.
  • Heading counts match between locales (data-storage 17/17, query-dsl 9/9); scripts/check-container-length.sh clean on all four pages; npm run build and npm run check:parity pass locally.

Issue closure

Closing keywords act only on pull requests merged into the default branch (master); this one targets alpha, so #103 is closed by hand after the merge.

Closes #103

Lifecycle hooks (#103)

The same page said no operator calls onCreate/onUpdate/onDelete/onLoad and that the audit columns stay NULL, which is 6.2.5 behaviour. Both warnings (en + zh) are replaced with what the framework at UltiTools-Reborn#559's head does, marked as of v6.3.0: which operation calls which hook, and how the audit columns and the command executor's current user are filled.

🤖 Generated with Claude Code

wisdommen and others added 2 commits September 29, 2026 21:03
…elete() count, as of v6.3.0

Companion to the UltiTools-Reborn data-layer pull request (#520, #522, #521,
#546, #543, #515). Prose and inline code only; no new examples/ reference.

- data-storage: reads return copies; null-id update/delete throws; SQLite
  NULL-id backfill; new Conditional Update section (updateIf)
- query-dsl: delete() returns the rows removed and refuses a null-id match

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…dateIf refusals

Follows the framework pull request's gate-1 review round.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T13:13:00.026511Z 4f960b2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Deploying ultitools-dev-doc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4f960b2
Status: ✅  Deploy successful!
Preview URL: https://08be52c1.ultitools-dev-doc.pages.dev
Branch Preview URL: https://docs-p17-fu-data.ultitools-dev-doc.pages.dev

View logs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd3cc8312c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +235 to +239
```java
Account read = dataOperator.getById(accountId);
double seen = read.getBalance();
read.setBalance(seen + amount);
boolean written = dataOperator.updateIf(read,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not duplicate the unreleased Java example

This adds an inline Java sample and a separately maintained Chinese copy, while repository guidance requires both locales to reference the same .java file with <<<. The duplicated snippets can drift and are not covered by the examples compilation check; because updateIf is still unreleased, keep this explanation prose-only until a shared example can compile against the released API.

AGENTS.md reference: AGENTS.md:L81-L85

Useful? React with 👍 / 👎.

wisdommen and others added 2 commits September 29, 2026 21:46
Follows the framework pull request's first Codex round.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…eCounted, as of v6.3.0

Follows UltiKits/UltiTools-Reborn#559 (#558).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9edf2343bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

As of v6.3.0, an update by an id that no row has writes nothing and logs one warning naming the table and the id, on every backend, and returns normally. To learn whether the update wrote, call `updateCounted(entity)`, which returns `1` for a written row and `0` when no row has the id:

```java
if (dataOperator.updateCounted(entity) == 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the second duplicated Java example

This later updateCounted addition creates a second inline Java example in both locales, separate from the updateIf snippet already called out. Repository guidance requires Java examples to be pulled from one shared .java file with <<<; because the examples project still targets 6.2.x, these two uncompiled copies can drift. Keep this example prose-only until a shared example can compile against 6.3.0.

AGENTS.md reference: AGENTS.md:L81-L85

Useful? React with 👍 / 👎.

The page still said no operator calls onCreate/onUpdate/onDelete/onLoad and that
the audit columns stay NULL, which is 6.2.5 behaviour. Replaced both warnings
(en + zh) with what UltiTools-Reborn at 7bc4ab68 (PR #559 head) does: which
operation calls which hook on every backend, and how the audit columns and the
command executor's current user are filled. #194 is closed; its links removed.

Closes #103

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant