utils

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](arr []T, target T) bool

Contains 函数通过泛型检查切片中是否包含目标元素

func LoadYAML

func LoadYAML(filename string, cfg interface{}) error

func StructToQueryParams added in v1.0.7

func StructToQueryParams(payload interface{}) (*object.StringMap, error)

StructToQueryParams converts a struct into a StringMap suitable for query parameters. It trims json tag options (e.g. omitempty) and drops empty string values to avoid emitting invalid parameters such as "id=" or "chart,omitempty".

Types

type JsonEncoder

type JsonEncoder struct {
	json.Encoder
	Data interface{}
}

func (*JsonEncoder) Encode

func (e *JsonEncoder) Encode() (io.Reader, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL