Files
native/query_params.go
zeekay 765c3d0aa1 hanzo-ds/native: de-branded native protocol lib (fork of clickhouse ch-go v0.71.0)
Module path, package names, and identifiers de-branded to native/proto/compress/
pool/tracing. Server wire-protocol strings preserved. Vendored codec surface used
by hanzo-ds/go (proto + compress).
2026-07-10 13:10:07 -07:00

28 lines
484 B
Go

package native
import (
"fmt"
"sort"
"github.com/hanzo-ds/native/proto"
)
// Parameters is helper for building Query.Parameters.
//
// EXPERIMENTAL.
func Parameters(m map[string]any) []proto.Parameter {
var out []proto.Parameter
for k, v := range m {
out = append(out, proto.Parameter{
Key: k,
Value: fmt.Sprintf("'%v'", v),
})
}
// Sorting to make output deterministic.
sort.Slice(out, func(i, j int) bool {
return out[i].Key < out[j].Key
})
return out
}