-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
224 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
package swagger | ||
|
||
import ( | ||
"reflect" | ||
"strings" | ||
"reflect" | ||
"strings" | ||
) | ||
|
||
const ( | ||
swagTagKey = "swag" | ||
swagSep = ";" | ||
swagIdentSep = ":" | ||
swagValueSep = "," | ||
swagTagKey = "swag" | ||
swagSep = ";" | ||
swagIdentSep = ":" | ||
swagValueSep = "," | ||
) | ||
|
||
type parsedStructTag struct { | ||
Name string | ||
Optional bool | ||
PossibleValues []string | ||
Name string | ||
Optional bool | ||
PossibleValues []string | ||
} | ||
|
||
func getParsedStructTag(tag reflect.StructTag, name string) parsedStructTag { | ||
pst := parsedStructTag{} | ||
nameTag := tag.Get(name) | ||
if nameTag == "" { | ||
return pst | ||
} | ||
pst := parsedStructTag{} | ||
nameTag := tag.Get(name) | ||
if nameTag == "" { | ||
return pst | ||
} | ||
|
||
// This is a hack to remove omitempty from tags | ||
fNameParts := strings.Split(nameTag, swagValueSep) | ||
if len(fNameParts) > 0 { | ||
pst.Name = strings.TrimSpace(fNameParts[0]) | ||
} | ||
// This is a hack to remove omitempty from tags | ||
fNameParts := strings.Split(nameTag, swagValueSep) | ||
if len(fNameParts) > 0 { | ||
pst.Name = strings.TrimSpace(fNameParts[0]) | ||
} | ||
|
||
swagTag := tag.Get(swagTagKey) | ||
parts := strings.Split(swagTag, swagSep) | ||
for _, p := range parts { | ||
x := strings.TrimSpace(strings.ToLower(p)) | ||
switch { | ||
case x == "optional": | ||
pst.Optional = true | ||
case strings.HasPrefix(x, "enum:"): | ||
xx := strings.SplitN(p, swagIdentSep, 2) | ||
if len(xx) == 2 { | ||
xx = strings.Split(xx[1], swagValueSep) | ||
for _, v := range xx { | ||
pst.PossibleValues = append(pst.PossibleValues, strings.TrimSpace(v)) | ||
} | ||
} | ||
} | ||
} | ||
swagTag := tag.Get(swagTagKey) | ||
parts := strings.Split(swagTag, swagSep) | ||
for _, p := range parts { | ||
x := strings.TrimSpace(strings.ToLower(p)) | ||
switch { | ||
case x == "optional": | ||
pst.Optional = true | ||
case strings.HasPrefix(x, "enum:"): | ||
xx := strings.SplitN(p, swagIdentSep, 2) | ||
if len(xx) == 2 { | ||
xx = strings.Split(xx[1], swagValueSep) | ||
for _, v := range xx { | ||
pst.PossibleValues = append(pst.PossibleValues, strings.TrimSpace(v)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
return pst | ||
return pst | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package tracekit | ||
|
||
import ( | ||
"github.com/clubpay/ronykit/kit" | ||
"go.opentelemetry.io/otel/trace" | ||
"github.com/clubpay/ronykit/kit" | ||
"go.opentelemetry.io/otel/trace" | ||
) | ||
|
||
func Span(ctx *kit.Context) trace.Span { | ||
return trace.SpanFromContext(ctx.Context()) | ||
return trace.SpanFromContext(ctx.Context()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.