String returns string representation of the key.
()
| 87 | |
| 88 | // String returns string representation of the key. |
| 89 | func (k *Key) String() string { |
| 90 | s := fmt.Sprintf("V%d; Query=%q; AcceptEncoding=%q; ClientProtocolVersion=%q; DefaultFormat=%q; Database=%q; Compress=%q; EnableHTTPCompression=%q; Namespace=%q; MaxResultRows=%q; Extremes=%q; ResultOverflowMode=%q; UserParams=%d; QueryParams=%d; UserCredentialHash=%d", |
| 91 | k.Version, k.Query, k.AcceptEncoding, k.ClientProtocolVersion, k.DefaultFormat, k.Database, k.Compress, k.EnableHTTPCompression, k.Namespace, |
| 92 | k.MaxResultRows, k.Extremes, k.ResultOverflowMode, k.UserParamsHash, k.QueryParamsHash, k.UserCredentialHash) |
| 93 | h := sha256.Sum256([]byte(s)) |
| 94 | |
| 95 | // The first 16 bytes of the hash should be enough |
| 96 | // for collision prevention :) |
| 97 | return hex.EncodeToString(h[:16]) |
| 98 | } |
no outgoing calls