Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ffd62dc
Add template_processor
artemklevtsov Oct 5, 2025
e0c76f8
Add glob support to the template processor
artemklevtsov Oct 5, 2025
0130ea9
fix: tmplProc.Close method
artemklevtsov Dec 8, 2025
7240afe
fix: template init
artemklevtsov Dec 8, 2025
37e7514
fix templateFromParsed error message
artemklevtsov Dec 8, 2025
f6f7d9b
fix: config examples
artemklevtsov Dec 8, 2025
bf033ed
chore: bump x/crypto package to 0.43.0 (#293)
josephwoodward Oct 10, 2025
6c3ba5a
chore: bump Go from 1.25.1 to 1.25.2 (#295)
josephwoodward Oct 13, 2025
76dfb20
netclient: introduce package to for custom TCP settings
alextreichler Oct 16, 2025
37e3a29
message: preallocate metadata (#300)
mmatczuk Oct 21, 2025
af6ccff
Extend field JSON schema (#301)
tomasz-sadura Oct 22, 2025
d625fe9
Allow deprecated templates (#302)
Jeffail Oct 23, 2025
c2c77f6
Network utils improvements (#297)
mmatczuk Oct 23, 2025
a2e715d
Update CL (#303)
Jeffail Oct 23, 2025
76bf934
bloblang: add "".repeat(N) method (#305)
rockwotj Oct 30, 2025
87fb518
netutil: fix the name of keep_alive idle value
alextreichler Oct 30, 2025
ad912c6
bloblang: add bytes function (#308)
rockwotj Oct 30, 2025
44aea24
netutil: enable decorating listener with SO_REUSEADDR and SO_REUSEPORT
vuldin Oct 31, 2025
cea8d61
Update CL (#311)
Jeffail Nov 3, 2025
c8fd7bc
netutil: add connect_timeout to DialerConfig
mmatczuk Nov 4, 2025
e6717ed
netutil: add connect_timeout to DialerConfig
mmatczuk Nov 4, 2025
a7dda98
netutil: make DialerConfigSpec() return advanced by default
mmatczuk Nov 4, 2025
80f3b69
netutil: add ListenerConfigSpec() and ListenerConfig constructor from…
mmatczuk Nov 4, 2025
bad4c4c
netutil: add support for windows
mmatczuk Nov 6, 2025
05de422
Update CL
mmatczuk Nov 7, 2025
88db177
io: add unixgram option to input socket server
alextreichler Nov 14, 2025
8f6ea44
build(deps): bump shutdown dependency (#320)
josephwoodward Nov 17, 2025
7f3d811
chore: bump changelog (#321)
josephwoodward Nov 21, 2025
eafc684
pure: fix input sequence hanging when input fails
eduardodbr Dec 5, 2025
568680a
io: add new listener opts to input socket_server
alextreichler Dec 5, 2025
66df7fc
Bump actions/setup-go from 5 to 6
dependabot[bot] Sep 8, 2025
2637d15
build(deps): bump golangci/golangci-lint-action from 8 to 9
dependabot[bot] Nov 10, 2025
ef116b5
build(deps): bump actions/checkout from 4 to 6
dependabot[bot] Dec 5, 2025
6f297eb
cli: add support for listing bloblang functions and methods with json…
mmatczuk Dec 2, 2025
bd675c0
cli/blobl: add input field
mmatczuk Dec 3, 2025
53660b2
cli/blobl: fix data race where program exits before printing output
mmatczuk Dec 3, 2025
edae09d
bloblang: function and method descriptions and examples overhaul
mmatczuk Dec 4, 2025
65b14e4
bloblang: create category general and register functions without cate…
mmatczuk Dec 4, 2025
8f599d3
bloblang/query: InCategory aggregate examples into the top-level Exam…
mmatczuk Dec 4, 2025
ccc4d19
Update CL
mmatczuk Dec 4, 2025
1ea1057
build(deps): bump the production-dependencies group across 1 director…
dependabot[bot] Dec 5, 2025
6fd6c25
service: fixe race condition in TestForceTimelyNacksBatchedNoAck
mmatczuk Dec 5, 2025
0c669e0
otel: update tracer name (#331)
rockwotj Dec 8, 2025
15225b0
otel: missed one instance of benthos (#332)
rockwotj Dec 8, 2025
c8eba2d
bloblang/query: add description to map_each
mmatczuk Dec 8, 2025
ab5e020
build(deps): bump the production-dependencies group with 2 updates
dependabot[bot] Dec 8, 2025
c6802ec
feat: add missing_key field
artemklevtsov Dec 8, 2025
0104c23
feeat: add template tests
artemklevtsov Dec 8, 2025
96537eb
fix" linter error
artemklevtsov Dec 8, 2025
ad34339
fix: format imports
artemklevtsov Dec 8, 2025
094f1e1
feaT: add array example
artemklevtsov Dec 9, 2025
28e4252
Merge branch 'main' into template-processor
artemklevtsov Dec 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bloblang: create category general and register functions without cate…
…gory under a proper category
  • Loading branch information
mmatczuk authored and artemklevtsov committed Dec 8, 2025
commit 65b14e41aec32c612df152348309e2c0c592c13b
1 change: 1 addition & 0 deletions internal/bloblang/query/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func NewHiddenFunctionSpec(name string) FunctionSpec {

// Method categories.
var (
MethodCategoryGeneral = "General"
MethodCategoryStrings = "String Manipulation"
MethodCategoryNumbers = "Number Manipulation"
MethodCategoryTime = "Timestamp Manipulation"
Expand Down
36 changes: 19 additions & 17 deletions internal/bloblang/query/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import (
)

var _ = registerMethod(
NewMethodSpec(
"apply",
"Apply a declared mapping to a target value.",
NewMethodSpec("apply", "Apply a declared mapping to a target value.").InCategory(
MethodCategoryGeneral, "",
NewExampleSpec("",
`map thing {
root.inner = this.first
Expand Down Expand Up @@ -146,9 +145,8 @@ func boolMethod(target Function, args *ParsedParams) (Function, error) {
//------------------------------------------------------------------------------

var _ = registerMethod(
NewMethodSpec(
"catch",
"If the result of a target query fails (due to incorrect types, failed parsing, etc) the argument is returned instead.",
NewMethodSpec("catch", "If the result of a target query fails (due to incorrect types, failed parsing, etc) the argument is returned instead.").InCategory(
MethodCategoryGeneral, "",
NewExampleSpec("",
`root.doc.id = this.thing.id.string().catch(uuid_v4())`,
),
Expand Down Expand Up @@ -185,9 +183,8 @@ func catchMethod(fn Function, args *ParsedParams) (Function, error) {
//------------------------------------------------------------------------------

var _ = registerMethod(
NewMethodSpec(
"from",
"Modifies a target query such that certain functions are executed from the perspective of another message in the batch. This allows you to mutate events based on the contents of other messages. Functions that support this behavior are `content`, `json` and `meta`.",
NewMethodSpec("from", "Modifies a target query such that certain functions are executed from the perspective of another message in the batch. This allows you to mutate events based on the contents of other messages. Functions that support this behavior are `content`, `json` and `meta`.").InCategory(
MethodCategoryGeneral, "",
NewExampleSpec("For example, the following map extracts the contents of the JSON field `foo` specifically from message index `1` of a batch, effectively overriding the field `foo` for all messages of a batch to that of message 1:",
`root = this
root.foo = json("foo").from(1)`,
Expand Down Expand Up @@ -227,9 +224,8 @@ func (f *fromMethod) QueryTargets(ctx TargetsContext) (TargetsContext, []TargetP
//------------------------------------------------------------------------------

var _ = registerMethod(
NewMethodSpec(
"from_all",
"Modifies a target query such that certain functions are executed from the perspective of each message in the batch, and returns the set of results as an array. Functions that support this behavior are `content`, `json` and `meta`.",
NewMethodSpec("from_all", "Modifies a target query such that certain functions are executed from the perspective of each message in the batch, and returns the set of results as an array. Functions that support this behavior are `content`, `json` and `meta`.").InCategory(
MethodCategoryGeneral, "",
NewExampleSpec("",
`root = this
root.foo_summed = json("foo").from_all().sum()`,
Expand Down Expand Up @@ -334,8 +330,9 @@ func getMethodCtor(target Function, args *ParsedParams) (Function, error) {
//------------------------------------------------------------------------------

var _ = registerMethod(
NewHiddenMethodSpec("map").
Param(ParamQuery("query", "A query to execute on the target.", false)),
NewMethodSpec("map", "Executes a query on the target value, allowing you to transform or extract data from the current context.").InCategory(
MethodCategoryGeneral, "",
).Param(ParamQuery("query", "A query to execute on the target.", false)),
mapMethod,
)

Expand Down Expand Up @@ -366,7 +363,12 @@ func mapMethod(target Function, args *ParsedParams) (Function, error) {

//------------------------------------------------------------------------------

var _ = registerMethod(NewHiddenMethodSpec("not"), notMethodCtor)
var _ = registerMethod(
NewMethodSpec("not", "Returns the logical NOT (negation) of a boolean value. Converts true to false and false to true.").InCategory(
MethodCategoryGeneral, "",
),
notMethodCtor,
)

type notMethod struct {
fn Function
Expand Down Expand Up @@ -512,8 +514,8 @@ func timestampCoerceMethod(target Function, args *ParsedParams) (Function, error
//------------------------------------------------------------------------------

var _ = registerMethod(
NewMethodSpec(
"or", "If the result of the target query fails or resolves to `null`, returns the argument instead. This is an explicit method alternative to the coalesce pipe operator `|`.",
NewMethodSpec("or", "If the result of the target query fails or resolves to `null`, returns the argument instead. This is an explicit method alternative to the coalesce pipe operator `|`.").InCategory(
MethodCategoryGeneral, "",
NewExampleSpec("", `root.doc.id = this.thing.id.or(uuid_v4())`),
).Param(ParamQuery("fallback", "A value to yield, or query to execute, if the target query fails or resolves to `null`.", true)),
orMethod,
Expand Down
12 changes: 9 additions & 3 deletions internal/bloblang/query/methods_strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,9 @@ var _ = registerSimpleMethod(
//------------------------------------------------------------------------------

var _ = registerSimpleMethod(
NewHiddenMethodSpec("replace").
NewMethodSpec("replace", "Replaces all occurrences of a substring with another string. Use for text transformation, cleaning data, or normalizing strings.").InCategory(
MethodCategoryStrings, "",
).
Param(ParamString("old", "A string to match against.")).
Param(ParamString("new", "A string to replace with.")),
replaceAllImpl,
Expand Down Expand Up @@ -1622,7 +1624,9 @@ func replaceAllImpl(args *ParsedParams) (simpleMethod, error) {
//------------------------------------------------------------------------------

var _ = registerSimpleMethod(
NewHiddenMethodSpec("replace_many").
NewMethodSpec("replace_many", "Performs multiple find-and-replace operations in sequence using an array of `[old, new]` pairs. More efficient than chaining multiple `replace_all` calls. Use for bulk text transformations.").InCategory(
MethodCategoryStrings, "",
).
Param(ParamArray("values", "An array of values, each even value will be replaced with the following odd value.")),
replaceAllManyImpl,
)
Expand Down Expand Up @@ -1966,7 +1970,9 @@ var _ = registerSimpleMethod(
//------------------------------------------------------------------------------

var _ = registerSimpleMethod(
NewHiddenMethodSpec("re_replace").
NewMethodSpec("re_replace", "Replaces all regex matches with a replacement string that can reference capture groups using `$1`, `$2`, etc. Use for pattern-based transformations or data reformatting.").InCategory(
MethodCategoryRegexp, "",
).
Param(ParamString("pattern", "The pattern to match against.")).
Param(ParamString("value", "The value to replace with.")),
reReplaceAllImpl,
Expand Down
5 changes: 2 additions & 3 deletions internal/bloblang/query/methods_structured.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,8 @@ var _ = registerSimpleMethod(
//------------------------------------------------------------------------------

var _ = registerSimpleMethod(
NewMethodSpec(
"exists",
"Checks whether a field exists at the specified dot path within an object. Returns true if the field is present (even if null), false otherwise.",
NewMethodSpec("exists", "Checks whether a field exists at the specified dot path within an object. Returns true if the field is present (even if null), false otherwise.").InCategory(
MethodCategoryObjectAndArray, "",
NewExampleSpec("",
`root.result = this.foo.exists("bar.baz")`,
`{"foo":{"bar":{"baz":"yep, I exist"}}}`,
Expand Down