mirror of
https://github.com/hanzo-ds/native.git
synced 2026-10-30 20:00:34 +00:00
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).
28 lines
484 B
Go
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
|
|
}
|