Skip to content

Commit e4d7474

Browse files
committed
documentation
1 parent 8e6c171 commit e4d7474

File tree

3 files changed

+61
-6
lines changed

3 files changed

+61
-6
lines changed

website/docs/.vitepress/config.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { defineConfig } from 'vitepress'
2-
2+
import { withMermaid } from 'vitepress-plugin-mermaid'
33
// https://vitepress.dev/reference/site-config
4-
export default defineConfig({
4+
5+
export default withMermaid({
56
title: "DML Lib",
67
description: "Apex DML Lib.",
78
head: [

website/docs/result.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ outline: deep
44

55
# Result
66

7-
The DML library provides comprehensive result handling through the `Result`, `OperationResult`, `RecordResult`, and `Error` interfaces. These allow you to inspect the outcome of DML operations, including success/failure status, record IDs, and error details.
7+
The DML library provides comprehensive result handling through the [`Result`](#result-interface), [`OperationResult`](#operationresult-interface), [`RecordResult`](#recordresult-interface), and [`Error`](#error-interface) interfaces. These allow you to inspect the outcome of DML operations, including success/failure status, record IDs, and error details.
88

99
## Overview
1010

11-
When you call `commitWork()` or `dryRun()`, a `Result` object is returned containing detailed information about each DML operation performed.
11+
When you call `commitWork()`, `commitTransaction()` or `dryRun()`, a `Result` object is returned containing detailed information about each DML operation performed.
12+
13+
::: info
14+
`Result` is returned only when **no errors occur** or `allowPartialSuccess()` is enabled. Otherwise, a `DmlException` will be thrown, which mimcs standard DML behaviour.
15+
:::
1216

1317
```apex
1418
DML.Result result = new DML()
@@ -24,6 +28,54 @@ List<DML.OperationResult> updateResults = result.updates();
2428
DML.OperationResult accountInserts = result.insertsOf(Account.SObjectType);
2529
```
2630

31+
```mermaid
32+
erDiagram
33+
Result ||--o{ OperationResult : "1:n"
34+
OperationResult ||--o{ RecordResult : "1:n"
35+
RecordResult ||--o{ Error : "1:n"
36+
37+
Result {
38+
List~OperationResult~ all()
39+
List~OperationResult~ inserts()
40+
List~OperationResult~ updates()
41+
List~OperationResult~ upserts()
42+
List~OperationResult~ deletes()
43+
List~OperationResult~ undeletes()
44+
List~OperationResult~ merges()
45+
List~OperationResult~ events()
46+
OperationResult insertsOf(SObjectType)
47+
OperationResult updatesOf(SObjectType)
48+
OperationResult upsertsOf(SObjectType)
49+
OperationResult deletesOf(SObjectType)
50+
OperationResult undeletesOf(SObjectType)
51+
OperationResult mergesOf(SObjectType)
52+
OperationResult eventsOf(SObjectType)
53+
}
54+
55+
OperationResult {
56+
OperationType operationType()
57+
SObjectType objectType()
58+
Boolean hasFailures()
59+
List~SObject~ successes()
60+
List~SObject~ failures()
61+
List~RecordResult~ recordResults()
62+
List~Error~ errors()
63+
}
64+
65+
RecordResult {
66+
Id id()
67+
SObject record()
68+
Boolean isSuccess()
69+
List~Error~ errors()
70+
}
71+
72+
Error {
73+
String message()
74+
StatusCode statusCode()
75+
List~String~ fields()
76+
}
77+
```
78+
2779
## Result Interface
2880

2981
The `Result` interface provides methods to access operation results.

website/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
"main": "index.js",
55
"license": "MIT",
66
"devDependencies": {
7-
"vitepress": "1.1.3"
7+
"mermaid": "^11.12.2",
8+
"vitepress": "1.1.3",
9+
"vitepress-plugin-mermaid": "^2.0.17"
810
},
911
"scripts": {
1012
"dev": "vitepress dev docs",
1113
"build": "vitepress build docs",
1214
"serve": "vitepress serve docs"
1315
}
14-
}
16+
}

0 commit comments

Comments
 (0)