Skip to content

Commit

Permalink
feat(crc32): add crc32 vrl function docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ivor11 committed Nov 30, 2024
1 parent fd9166b commit 855af8c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion website/cue/reference/remap/functions.cue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ remap: {
pure: bool | *true
}

#FunctionCategory: "Array" | "Codec" | "Coerce" | "Convert" | "Debug" | "Enrichment" | "Enumerate" | "Event" | "Path" | "Cryptography" | "IP" | "Number" | "Object" | "Parse" | "Random" | "String" | "System" | "Timestamp" | "Type"
#FunctionCategory: "Array" | "Codec" | "Coerce" | "Convert" | "Debug" | "Enrichment" | "Enumerate" | "Event" | "Path" | "Cryptography" | "IP" | "Number" | "Object" | "Parse" | "Random" | "String" | "System" | "Timestamp" | "Type" | "Checksum"

// A helper array for generating docs. At some point, we should generate this from the
// #FunctionCategory enum if CUE adds support for that.
Expand All @@ -52,6 +52,7 @@ remap: {
"System",
"Timestamp",
"Type",
"Checksum",
]

functions: [Name=string]: #Function & {
Expand Down
29 changes: 29 additions & 0 deletions website/cue/reference/remap/functions/crc32.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package metadata

remap: functions: crc32: {
category: "Checksum"
description: """
Calculates a CRC32 of the `value`.
"""

arguments: [
{
name: "value"
description: "The string to calculate the checksum for."
required: true
type: ["string"]
},
]
internal_failure_reasons: []
return: types: ["string"]

examples: [
{
title: "Create CRC32 checksum"
source: #"""
crc32("foo")
"""#
return: "8c736521"
},
]
}

0 comments on commit 855af8c

Please sign in to comment.