Skip to content

Commit

Permalink
Rename toJson function
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Dec 20, 2023
1 parent 35109f4 commit ba75c02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/backup/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var templateHelpers = template.FuncMap{
return formatBytes(bytes, false)
},
"env": os.Getenv,
"toJSON": toJSON,
"toJson": toJson,
"toPrettyJson": toPrettyJson,
}

Expand All @@ -110,7 +110,7 @@ func formatBytes(b uint64, decimal bool) string {
return fmt.Sprintf(format, float64(b)/float64(div), "kMGTPE"[exp])
}

func toJSON(v interface{}) string {
func toJson(v interface{}) string {
var bytes []byte
var err error
if bytes, err = json.Marshal(v); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/how-tos/set-up-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Some formatting and helper functions are also available:
* `formatBytesBin`: formats an amount of bytes using powers of 1024 (e.g. `7055258` bytes will be `6.7 MiB`)
* `formatBytesDec`: formats an amount of bytes using powers of 1000 (e.g. `7055258` bytes will be `7.1 MB`)
* `env`: returns the value of the environment variable of the given key if set
* `toJSON`: converting object to JSON
* `toJson`: converting object to JSON
* `toPrettyJson`: converting object to pretty JSON

## Special characters in notification URLs
Expand Down

0 comments on commit ba75c02

Please sign in to comment.