Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ottl/pkg] Remove the ottlarg struct tag for the arguments and rely on field ordering #25705

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
[chore] Remove the ottlarg struct tag and rely on field ordering
  • Loading branch information
rnishtala-sumo committed Aug 21, 2023
commit c9567196500fa5ed5763b00c6296e6108698f347
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_concat.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

type ConcatArguments[K any] struct {
Vals []ottl.StringLikeGetter[K] `ottlarg:"0"`
Delimiter string `ottlarg:"1"`
Vals []ottl.StringLikeGetter[K]
Delimiter string
}

func NewConcatFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_convert_case.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
)

type ConvertCaseArguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
ToCase string `ottlarg:"1"`
Target ottl.StringGetter[K]
ToCase string
}

func NewConvertCaseFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_delete_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

type DeleteKeyArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Key string `ottlarg:"1"`
Target ottl.PMapGetter[K]
Key string
}

func NewDeleteKeyFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_delete_matching_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
)

type DeleteMatchingKeysArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Pattern string `ottlarg:"1"`
Target ottl.PMapGetter[K]
Pattern string
}

func NewDeleteMatchingKeysFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

type DurationArguments[K any] struct {
Duration ottl.StringGetter[K] `ottlarg:"0"`
Duration ottl.StringGetter[K]
}

func NewDurationFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_fnv.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

type FnvArguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
Target ottl.StringGetter[K]
}

func NewFnvFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_int.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

type IntArguments[K any] struct {
Target ottl.IntLikeGetter[K] `ottlarg:"0"`
Target ottl.IntLikeGetter[K]
}

func NewIntFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_is_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

type IsMapArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Target ottl.PMapGetter[K]
}

func NewIsMapFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_is_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

type IsMatchArguments[K any] struct {
Target ottl.StringLikeGetter[K] `ottlarg:"0"`
Pattern string `ottlarg:"1"`
Target ottl.StringLikeGetter[K]
Pattern string
}

func NewIsMatchFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_is_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

type IsStringArguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
Target ottl.StringGetter[K]
}

func NewIsStringFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_keep_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
)

type KeepKeysArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Keys []string `ottlarg:"1"`
Target ottl.PMapGetter[K]
Keys []string
}

func NewKeepKeysFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_len.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
)

type LenArguments[K any] struct {
Target ottl.Getter[K] `ottlarg:"0"`
Target ottl.Getter[K]
}

func NewLenFactory[K any]() ottl.Factory[K] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/ottl/ottlfuncs/func_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
)

type LimitArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Limit int64 `ottlarg:"1"`
PriorityKeys []string `ottlarg:"2"`
Target ottl.PMapGetter[K]
Limit int64
PriorityKeys []string
}

func NewLimitFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

type LogArguments[K any] struct {
Target ottl.FloatLikeGetter[K] `ottlarg:"0"`
Target ottl.FloatLikeGetter[K]
}

func NewLogFactory[K any]() ottl.Factory[K] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/ottl/ottlfuncs/func_merge_maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const (
)

type MergeMapsArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Source ottl.PMapGetter[K] `ottlarg:"1"`
Strategy string `ottlarg:"2"`
Target ottl.PMapGetter[K]
Source ottl.PMapGetter[K]
Strategy string
}

func NewMergeMapsFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_parse_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

type ParseJSONArguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
Target ottl.StringGetter[K]
}

func NewParseJSONFactory[K any]() ottl.Factory[K] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/ottl/ottlfuncs/func_replace_all_matches.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
)

type ReplaceAllMatchesArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Pattern string `ottlarg:"1"`
Replacement ottl.StringGetter[K] `ottlarg:"2"`
Target ottl.PMapGetter[K]
Pattern string
Replacement ottl.StringGetter[K]
}

func NewReplaceAllMatchesFactory[K any]() ottl.Factory[K] {
Expand Down
8 changes: 4 additions & 4 deletions pkg/ottl/ottlfuncs/func_replace_all_patterns.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const (
)

type ReplaceAllPatternsArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Mode string `ottlarg:"1"`
RegexPattern string `ottlarg:"2"`
Replacement ottl.StringGetter[K] `ottlarg:"3"`
Target ottl.PMapGetter[K]
Mode string
RegexPattern string
Replacement ottl.StringGetter[K]
}

func NewReplaceAllPatternsFactory[K any]() ottl.Factory[K] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/ottl/ottlfuncs/func_replace_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
)

type ReplaceMatchArguments[K any] struct {
Target ottl.GetSetter[K] `ottlarg:"0"`
Pattern string `ottlarg:"1"`
Replacement ottl.StringGetter[K] `ottlarg:"2"`
Target ottl.GetSetter[K]
Pattern string
Replacement ottl.StringGetter[K]
}

func NewReplaceMatchFactory[K any]() ottl.Factory[K] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/ottl/ottlfuncs/func_replace_pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
)

type ReplacePatternArguments[K any] struct {
Target ottl.GetSetter[K] `ottlarg:"0"`
RegexPattern string `ottlarg:"1"`
Replacement ottl.StringGetter[K] `ottlarg:"2"`
Target ottl.GetSetter[K]
RegexPattern string
Replacement ottl.StringGetter[K]
}

func NewReplacePatternFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

type SetArguments[K any] struct {
Target ottl.Setter[K] `ottlarg:"0"`
Value ottl.Getter[K] `ottlarg:"1"`
Target ottl.Setter[K]
Value ottl.Getter[K]
}

func NewSetFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_sha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

type SHA1Arguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
Target ottl.StringGetter[K]
}

func NewSHA1Factory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_sha256.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

type SHA256Arguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
Target ottl.StringGetter[K]
}

func NewSHA256Factory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_span_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

type SpanIDArguments[K any] struct {
Bytes []byte `ottlarg:"0"`
Bytes []byte
}

func NewSpanIDFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_split.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

type SplitArguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
Delimiter string `ottlarg:"1"`
Target ottl.StringGetter[K]
Delimiter string
}

func NewSplitFactory[K any]() ottl.Factory[K] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/ottl/ottlfuncs/func_substring.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
)

type SubstringArguments[K any] struct {
Target ottl.StringGetter[K] `ottlarg:"0"`
Start ottl.IntGetter[K] `ottlarg:"1"`
Length ottl.IntGetter[K] `ottlarg:"2"`
Target ottl.StringGetter[K]
Start int64
Length int64
}

func NewSubstringFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

type TimeArguments[K any] struct {
Time ottl.StringGetter[K] `ottlarg:"0"`
Format string `ottlarg:"1"`
Time ottl.StringGetter[K]
Format string
}

func NewTimeFactory[K any]() ottl.Factory[K] {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ottl/ottlfuncs/func_trace_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

type TraceIDArguments[K any] struct {
Bytes []byte `ottlarg:"0"`
Bytes []byte
}

func NewTraceIDFactory[K any]() ottl.Factory[K] {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ottl/ottlfuncs/func_truncate_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
)

type TruncateAllArguments[K any] struct {
Target ottl.PMapGetter[K] `ottlarg:"0"`
Limit int64 `ottlarg:"1"`
Target ottl.PMapGetter[K]
Limit int64
}

func NewTruncateAllFactory[K any]() ottl.Factory[K] {
Expand Down