From ce14b614c70c333a84d581c467aa3be71f04e27a Mon Sep 17 00:00:00 2001 From: Simon Herrmann Date: Mon, 19 Jan 2026 11:38:50 +0100 Subject: [PATCH 1/3] add support for uuid --- core/runner_test.go | 27 ++++++++++++++++++--------- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/core/runner_test.go b/core/runner_test.go index d1c0556..03f1ecb 100644 --- a/core/runner_test.go +++ b/core/runner_test.go @@ -7,6 +7,7 @@ import ( "testing" "time" + "github.com/google/uuid" "github.com/siherrmann/queuer/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -434,6 +435,7 @@ type TestConfig struct { type TestData struct { ID int + RID uuid.UUID Message string Active bool } @@ -450,7 +452,7 @@ func taskWithStructParams(config TestConfig, data *TestData) (string, error) { if data == nil { return "", fmt.Errorf("data cannot be nil") } - return fmt.Sprintf("%s-%d: %s (ID: %d, Active: %t)", config.Name, config.Value, data.Message, data.ID, data.Active), nil + return fmt.Sprintf("%s-%d: %s (ID: %d, RID: %s, Active: %t)", config.Name, config.Value, data.Message, data.ID, data.RID.String(), data.Active), nil } // Task function that accepts a nested struct with both struct and pointer fields @@ -458,7 +460,7 @@ func taskWithNestedStruct(nested NestedStruct) (string, error) { if nested.DataPtr == nil { return "", fmt.Errorf("nested.DataPtr cannot be nil") } - return fmt.Sprintf("%s: %s-%d | %s (ID: %d, Active: %t)", nested.Metadata, nested.Config.Name, nested.Config.Value, nested.DataPtr.Message, nested.DataPtr.ID, nested.DataPtr.Active), nil + return fmt.Sprintf("%s: %s-%d | %s (ID: %d, RID: %s, Active: %t)", nested.Metadata, nested.Config.Name, nested.Config.Value, nested.DataPtr.Message, nested.DataPtr.ID, nested.DataPtr.RID.String(), nested.DataPtr.Active), nil } // TestNewRunnerWithStructParameters tests the runner with struct and pointer-to-struct parameters @@ -478,11 +480,12 @@ func TestNewRunnerWithStructParameters(t *testing.T) { }, param2: &TestData{ ID: 1, + RID: uuid.MustParse("550e8400-e29b-41d4-a716-446655440001"), Message: "test message", Active: true, }, wantErr: false, - wantResult: "config-42: test message (ID: 1, Active: true)", + wantResult: "config-42: test message (ID: 1, RID: 550e8400-e29b-41d4-a716-446655440001, Active: true)", }, { name: "Map to Struct and Map to Pointer Conversion", @@ -492,11 +495,12 @@ func TestNewRunnerWithStructParameters(t *testing.T) { }, param2: map[string]interface{}{ "ID": 2, + "RID": "550e8400-e29b-41d4-a716-446655440001", "Message": "converted from map", "Active": false, }, wantErr: false, - wantResult: "fromMap-99: converted from map (ID: 2, Active: false)", + wantResult: "fromMap-99: converted from map (ID: 2, RID: 550e8400-e29b-41d4-a716-446655440001, Active: false)", }, { name: "Struct Value and Map to Pointer", @@ -506,11 +510,12 @@ func TestNewRunnerWithStructParameters(t *testing.T) { }, param2: map[string]interface{}{ "ID": 3, + "RID": "550e8400-e29b-41d4-a716-446655440001", "Message": "mixed params", "Active": true, }, wantErr: false, - wantResult: "direct-10: mixed params (ID: 3, Active: true)", + wantResult: "direct-10: mixed params (ID: 3, RID: 550e8400-e29b-41d4-a716-446655440001, Active: true)", }, { name: "Map to Struct with Type Conversion", @@ -520,11 +525,12 @@ func TestNewRunnerWithStructParameters(t *testing.T) { }, param2: map[string]interface{}{ "ID": 4.0, // float64 should convert to int + "RID": "550e8400-e29b-41d4-a716-446655440001", "Message": "type conversion test", "Active": true, }, wantErr: false, - wantResult: "typeConv-25: type conversion test (ID: 4, Active: true)", + wantResult: "typeConv-25: type conversion test (ID: 4, RID: 550e8400-e29b-41d4-a716-446655440001, Active: true)", }, } @@ -593,13 +599,14 @@ func TestNewRunnerWithNestedStruct(t *testing.T) { }, DataPtr: &TestData{ ID: 10, + RID: uuid.MustParse("550e8400-e29b-41d4-a716-446655440001"), Message: "nested data", Active: true, }, Metadata: "meta-direct", }, wantErr: false, - wantResult: "meta-direct: nested-config-100 | nested data (ID: 10, Active: true)", + wantResult: "meta-direct: nested-config-100 | nested data (ID: 10, RID: 550e8400-e29b-41d4-a716-446655440001, Active: true)", }, { name: "Map to Nested Struct Conversion", @@ -610,13 +617,14 @@ func TestNewRunnerWithNestedStruct(t *testing.T) { }, "DataPtr": map[string]interface{}{ "ID": 20, + "RID": "550e8400-e29b-41d4-a716-446655440001", "Message": "map data", "Active": false, }, "Metadata": "meta-from-map", }, wantErr: false, - wantResult: "meta-from-map: map-config-200 | map data (ID: 20, Active: false)", + wantResult: "meta-from-map: map-config-200 | map data (ID: 20, RID: 550e8400-e29b-41d4-a716-446655440001, Active: false)", }, { name: "Map with Type Conversions in Nested Struct", @@ -627,13 +635,14 @@ func TestNewRunnerWithNestedStruct(t *testing.T) { }, "DataPtr": map[string]interface{}{ "ID": 30.0, // float64 to int + "RID": "550e8400-e29b-41d4-a716-446655440001", "Message": "type conversion", "Active": true, }, "Metadata": "meta-type-conv", }, wantErr: false, - wantResult: "meta-type-conv: type-conv-300 | type conversion (ID: 30, Active: true)", + wantResult: "meta-type-conv: type-conv-300 | type conversion (ID: 30, RID: 550e8400-e29b-41d4-a716-446655440001, Active: true)", }, } diff --git a/go.mod b/go.mod index 125763c..15339cf 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/shirou/gopsutil/v4 v4.25.10 // indirect github.com/siherrmann/queuerSql v0.0.0-20251130135331-9ed23b19fae5 - github.com/siherrmann/validator v0.12.0 + github.com/siherrmann/validator v0.15.0 github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/cobra v1.10.1 github.com/tklauser/go-sysconf v0.3.16 // indirect diff --git a/go.sum b/go.sum index 9e1c990..2b0c27a 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil/v4 v4.25.10 h1:at8lk/5T1OgtuCp+AwrDofFRjnvosn0nkN2OLQ6g8tA= github.com/shirou/gopsutil/v4 v4.25.10/go.mod h1:+kSwyC8DRUD9XXEHCAFjK+0nuArFJM0lva+StQAcskM= -github.com/siherrmann/validator v0.12.0 h1:bW80s6cXVuqIYPWCB8nboXryJWVog1C+XOQW72XovbE= -github.com/siherrmann/validator v0.12.0/go.mod h1:LqNNViIg5YKzO4SX4zMdafyffL6xCWuRqSyt1szpolo= +github.com/siherrmann/validator v0.15.0 h1:5mnBDsExYA+7w+w5r5aPo3nL3Nlv8EI0PUYrXEXj+Lw= +github.com/siherrmann/validator v0.15.0/go.mod h1:EO/YNTu2qDR7JPR7sPPjurlm+35G/HAijykBJxVFezE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= From 80bbe6d7ae7aebf9aeffac57618116dabec5406c Mon Sep 17 00:00:00 2001 From: Simon Herrmann Date: Mon, 19 Jan 2026 12:19:47 +0100 Subject: [PATCH 2/3] add support for pointer arrays --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 15339cf..d8dfb40 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/shirou/gopsutil/v4 v4.25.10 // indirect github.com/siherrmann/queuerSql v0.0.0-20251130135331-9ed23b19fae5 - github.com/siherrmann/validator v0.15.0 + github.com/siherrmann/validator v0.16.0 github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/cobra v1.10.1 github.com/tklauser/go-sysconf v0.3.16 // indirect diff --git a/go.sum b/go.sum index 2b0c27a..b363328 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil/v4 v4.25.10 h1:at8lk/5T1OgtuCp+AwrDofFRjnvosn0nkN2OLQ6g8tA= github.com/shirou/gopsutil/v4 v4.25.10/go.mod h1:+kSwyC8DRUD9XXEHCAFjK+0nuArFJM0lva+StQAcskM= -github.com/siherrmann/validator v0.15.0 h1:5mnBDsExYA+7w+w5r5aPo3nL3Nlv8EI0PUYrXEXj+Lw= -github.com/siherrmann/validator v0.15.0/go.mod h1:EO/YNTu2qDR7JPR7sPPjurlm+35G/HAijykBJxVFezE= +github.com/siherrmann/validator v0.16.0 h1:u0Bdv29l0/WCLQIr/GZoHOzd1yct835cak1OljFF30o= +github.com/siherrmann/validator v0.16.0/go.mod h1:EO/YNTu2qDR7JPR7sPPjurlm+35G/HAijykBJxVFezE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= From 7a31f8e64ab8fa8a1cd56fbf9fb205eb744607fb Mon Sep 17 00:00:00 2001 From: Simon Herrmann Date: Mon, 19 Jan 2026 14:51:08 +0100 Subject: [PATCH 3/3] add support for time --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d8dfb40..4b7352a 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/shirou/gopsutil/v4 v4.25.10 // indirect github.com/siherrmann/queuerSql v0.0.0-20251130135331-9ed23b19fae5 - github.com/siherrmann/validator v0.16.0 + github.com/siherrmann/validator v0.18.0 github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/cobra v1.10.1 github.com/tklauser/go-sysconf v0.3.16 // indirect diff --git a/go.sum b/go.sum index b363328..0e33c17 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil/v4 v4.25.10 h1:at8lk/5T1OgtuCp+AwrDofFRjnvosn0nkN2OLQ6g8tA= github.com/shirou/gopsutil/v4 v4.25.10/go.mod h1:+kSwyC8DRUD9XXEHCAFjK+0nuArFJM0lva+StQAcskM= -github.com/siherrmann/validator v0.16.0 h1:u0Bdv29l0/WCLQIr/GZoHOzd1yct835cak1OljFF30o= -github.com/siherrmann/validator v0.16.0/go.mod h1:EO/YNTu2qDR7JPR7sPPjurlm+35G/HAijykBJxVFezE= +github.com/siherrmann/validator v0.18.0 h1:WZYq3rODsF47kMX8cqCs70hWIRc8gHl855FXfMei6lk= +github.com/siherrmann/validator v0.18.0/go.mod h1:EO/YNTu2qDR7JPR7sPPjurlm+35G/HAijykBJxVFezE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=