| 1 |
import { |
| 2 |
transformTimestampArgument, |
| 3 |
pushRetentionArgument, |
| 4 |
TimeSeriesEncoding, |
| 5 |
pushEncodingArgument, |
| 6 |
pushChunkSizeArgument, |
| 7 |
TimeSeriesDuplicatePolicies, |
| 8 |
Labels, |
| 9 |
pushLabelsArgument, |
| 10 |
Timestamp, |
| 11 |
} from '.'; |
| 12 |
|
| 13 |
interface AddOptions { |
| 14 |
RETENTION?: number; |
| 15 |
ENCODING?: TimeSeriesEncoding; |
| 16 |
CHUNK_SIZE?: number; |
| 17 |
ON_DUPLICATE?: TimeSeriesDuplicatePolicies; |
| 18 |
LABELS?: Labels; |
| 19 |
} |
| 20 |
|
| 21 |
export const FIRST_KEY_INDEX = 1; |
| 22 |
|
| 23 |
export function transformArguments(key: string, timestamp: Timestamp, value: number, options?: AddOptions): Array<string> { |
| 24 |
const args = [ |
| 25 |
'TS.ADD', |
| 26 |
key, |
| 27 |
transformTimestampArgument(timestamp), |
| 28 |
value.toString() |
| 29 |
]; |
| 30 |
|
| 31 |
pushRetentionArgument(args, options?.RETENTION); |
| 32 |
|
| 33 |
pushEncodingArgument(args, options?.ENCODING); |
| 34 |
|
| 35 |
pushChunkSizeArgument(args, options?.CHUNK_SIZE); |
| 36 |
|
| 37 |
if (options?.ON_DUPLICATE) { |
| 38 |
args.push('ON_DUPLICATE', options.ON_DUPLICATE); |
| 39 |
} |
| 40 |
|
| 41 |
pushLabelsArgument(args, options?.LABELS); |
| 42 |
|
| 43 |
return args; |
| 44 |
} |
| 45 |
|
| 46 |
export declare function transformReply(): number; |