Skip to content

Commit c9cbd3a

Browse files
committed
Update README
1 parent 265aa13 commit c9cbd3a

File tree

1 file changed

+14
-61
lines changed

1 file changed

+14
-61
lines changed

README.md

+14-61
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
batchforce
2-
==========
1+
# batchforce
32

4-
A go library and CLI to make bulk updates in Salesforce using a SOQL query and the Bulk
5-
API.
3+
A command-line application to make bulk updates in Salesforce using the Bulk API.
4+
5+
* Use a SOQL query to retrieve the input data.
6+
* Use an expr expression to transform the input into the data to load into Salesforce
67

78
The active [force CLI](https://github.com/ForceCLI/force) login is used, so log
89
in using `force login` or set your active user using `force active -a
910
<username>` before running your application.
1011

11-
Installation
12-
============
12+
## Installation
13+
14+
Download the latest release from
15+
https://github.com/octoberswimmer/batchforce/releases. Executables are
16+
available for Windows, Linux and MacOS.
1317

18+
Install from source:
1419
```
15-
$ go install github.com/octoberswimmer/batchforce/cmd/batchforce
20+
$ go install github.com/octoberswimmer/batchforce/cmd/batchforce@latest
1621
```
1722

18-
CLI Example
19-
===========
23+
## Example Usage
2024

2125
Each record is made available to [expr](https://github.com/antonmedv/expr/blob/master/docs/Language-Definition.md) as
2226
`record`. The expr expression should evaluate to a single map or an array of
@@ -31,8 +35,7 @@ This will query all Accounts whose Name doesn't end with "Test" and append "Test
3135

3236
See [docs/batchforce.md](docs/batchforce.md) for all supported commands.
3337

34-
CLI Help
35-
========
38+
## CLI Help
3639

3740
```
3841
$ batchforce help
@@ -95,53 +98,3 @@ Flags:
9598
9699
Use "batchforce [command] --help" for more information about a command.
97100
```
98-
99-
Library Example
100-
===============
101-
102-
```go
103-
package main
104-
105-
import (
106-
batch "github.com/octoberswimmer/batchforce"
107-
force "github.com/ForceCLI/force/lib"
108-
"time"
109-
)
110-
111-
var (
112-
fiftyYearsAgo = time.Now().AddDate(-50, 0, 0)
113-
thirtyYearsAgo = time.Now().AddDate(-30, 0, 0)
114-
)
115-
116-
func main() {
117-
query := `
118-
SELECT
119-
Id,
120-
Birthdate
121-
FROM
122-
Contact
123-
WHERE
124-
Birthdate != null
125-
`
126-
127-
batch.Run("Contact", query, setTitle)
128-
}
129-
130-
func setTitle(record force.ForceRecord) (updates []force.ForceRecord) {
131-
birthdate, err := time.Parse("2006-01-02", record["Birthdate"].(string))
132-
if err != nil {
133-
return
134-
}
135-
update := force.ForceRecord{}
136-
update["Id"] = record["Id"].(string)
137-
switch {
138-
case birthdate.Before(fiftyYearsAgo):
139-
update["Title"] = "Geezer"
140-
updates = append(updates, update)
141-
case birthdate.After(thirtyYearsAgo):
142-
update["Title"] = "Whippersnapper"
143-
updates = append(updates, update)
144-
}
145-
return
146-
}
147-
```

0 commit comments

Comments
 (0)