refactor(context): refactor Keys type to map[any]any (#3963)
* refactor(context): refactor keys to `map[any]any` Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com> * refactor(context): refactor keys to `map[any]any` Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com> * style(context): remove empty lines before GetInt16, GetIntSlice, and GetStringMapString methods - Remove unnecessary empty lines in the context.go file - Improve code readability and consistency Signed-off-by: flc1125 <four_leaf_clover@foxmail.com> * refactor(context): simplify GetStringSlice function - Replace manual type assertion with generic getTyped function - Reduce code duplication and improve type safety Signed-off-by: flc1125 <four_leaf_clover@foxmail.com> * test(context): improve context.Set and context.Get tests - Split existing test into separate functions for different scenarios - Add test for setting and getting values with any key type - Add test for handling non-comparable keys - Improve assertions to check for key existence and value correctness Signed-off-by: flc1125 <four_leaf_clover@foxmail.com> * refactor(context): replace fmt.Errorf with fmt.Sprintf in panic message * test(context): remove trailing hyphen from context_test.go * refactor(context): improve error message for missing key in context - Remove unnecessary quotes around the key in the error message - Simplify the error message format for better readability * test(context): improve panic test message for non-existent key --------- Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com> Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
This commit is contained in:
@@ -82,7 +82,7 @@ type LogFormatterParams struct {
|
||||
// BodySize is the size of the Response Body
|
||||
BodySize int
|
||||
// Keys are the keys set on the request's context.
|
||||
Keys map[string]any
|
||||
Keys map[any]any
|
||||
}
|
||||
|
||||
// StatusCodeColor is the ANSI color for appropriately logging http status code to a terminal.
|
||||
|
||||
Reference in New Issue
Block a user