From 0fdd2e19c8a950feebbe77417913e04dbaa86081 Mon Sep 17 00:00:00 2001 From: ChrisDev83 <12744395+ChrisDev83@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:51:42 +0100 Subject: [PATCH] Add nano precision option. (#283) * Add nano precision option. * Unsure whether to add test as existing tests dont test the format as it is. * Fix indentation * Add nanoPrecision to api-docs --------- Co-authored-by: Mostafa Moradian --- api-docs/docs/README.md | 2 +- api-docs/docs/classes/Connection.md | 10 ++-- api-docs/docs/classes/Reader.md | 8 +-- api-docs/docs/classes/SchemaRegistry.md | 12 ++--- api-docs/docs/classes/Writer.md | 6 +-- api-docs/docs/interfaces/ConfigEntry.md | 4 +- api-docs/docs/interfaces/ConnectionConfig.md | 6 +-- api-docs/docs/interfaces/ConsumeConfig.md | 11 ++++ api-docs/docs/interfaces/Container.md | 6 +-- api-docs/docs/interfaces/JKS.md | 6 +-- api-docs/docs/interfaces/JKSConfig.md | 12 ++--- api-docs/docs/interfaces/Reference.md | 6 +-- api-docs/docs/interfaces/ReplicaAssignment.md | 4 +- api-docs/docs/interfaces/Schema.md | 14 +++--- api-docs/docs/interfaces/SubjectNameConfig.md | 8 +-- api-docs/docs/interfaces/TopicConfig.md | 10 ++-- api-docs/index.d.ts | 3 +- api-docs/yarn.lock | 50 +++++++++---------- reader.go | 12 ++++- 19 files changed, 105 insertions(+), 85 deletions(-) diff --git a/api-docs/docs/README.md b/api-docs/docs/README.md index dce8c37..bb43d14 100644 --- a/api-docs/docs/README.md +++ b/api-docs/docs/README.md @@ -92,4 +92,4 @@ const jks = LoadJKS({ #### Defined in -[index.d.ts:542](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L542) +[index.d.ts:543](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L543) diff --git a/api-docs/docs/classes/Connection.md b/api-docs/docs/classes/Connection.md index 356f31a..baf5708 100644 --- a/api-docs/docs/classes/Connection.md +++ b/api-docs/docs/classes/Connection.md @@ -44,7 +44,7 @@ connection.close(); #### Defined in -[index.d.ts:399](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L399) +[index.d.ts:400](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L400) ## Methods @@ -64,7 +64,7 @@ connection.close(); #### Defined in -[index.d.ts:425](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L425) +[index.d.ts:426](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L426) --- @@ -89,7 +89,7 @@ Create a new topic. #### Defined in -[index.d.ts:406](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L406) +[index.d.ts:407](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L407) --- @@ -114,7 +114,7 @@ Delete a topic. #### Defined in -[index.d.ts:413](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L413) +[index.d.ts:414](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L414) --- @@ -133,4 +133,4 @@ List topics. #### Defined in -[index.d.ts:419](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L419) +[index.d.ts:420](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L420) diff --git a/api-docs/docs/classes/Reader.md b/api-docs/docs/classes/Reader.md index 91559dd..c252c0a 100644 --- a/api-docs/docs/classes/Reader.md +++ b/api-docs/docs/classes/Reader.md @@ -12,7 +12,7 @@ const reader = new Reader({ }); // In VU code (default function) -const messages = reader.consume({ limit: 10 }); +const messages = reader.consume({ limit: 10, nanoPrecision: false }); // In teardown function reader.close(); @@ -43,7 +43,7 @@ reader.close(); #### Defined in -[index.d.ts:358](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L358) +[index.d.ts:359](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L359) ## Methods @@ -63,7 +63,7 @@ reader.close(); #### Defined in -[index.d.ts:371](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L371) +[index.d.ts:372](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L372) --- @@ -88,4 +88,4 @@ Read messages from Kafka. #### Defined in -[index.d.ts:365](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L365) +[index.d.ts:366](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L366) diff --git a/api-docs/docs/classes/SchemaRegistry.md b/api-docs/docs/classes/SchemaRegistry.md index e557943..a13f255 100644 --- a/api-docs/docs/classes/SchemaRegistry.md +++ b/api-docs/docs/classes/SchemaRegistry.md @@ -79,7 +79,7 @@ writer.produce({ #### Defined in -[index.d.ts:487](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L487) +[index.d.ts:488](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L488) ## Methods @@ -104,7 +104,7 @@ Create or update a schema on Schema Registry. #### Defined in -[index.d.ts:501](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L501) +[index.d.ts:502](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L502) --- @@ -129,7 +129,7 @@ Deserializes the given data and schema into its original form. #### Defined in -[index.d.ts:522](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L522) +[index.d.ts:523](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L523) --- @@ -154,7 +154,7 @@ Get a schema from Schema Registry by version and subject. #### Defined in -[index.d.ts:494](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L494) +[index.d.ts:495](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L495) --- @@ -179,7 +179,7 @@ Returns the subject name for the given SubjectNameConfig. #### Defined in -[index.d.ts:508](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L508) +[index.d.ts:509](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L509) --- @@ -204,4 +204,4 @@ Serializes the given data and schema into a byte array. #### Defined in -[index.d.ts:515](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L515) +[index.d.ts:516](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L516) diff --git a/api-docs/docs/classes/Writer.md b/api-docs/docs/classes/Writer.md index d585446..a3eb511 100644 --- a/api-docs/docs/classes/Writer.md +++ b/api-docs/docs/classes/Writer.md @@ -51,7 +51,7 @@ writer.close(); #### Defined in -[index.d.ts:316](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L316) +[index.d.ts:317](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L317) ## Methods @@ -71,7 +71,7 @@ writer.close(); #### Defined in -[index.d.ts:329](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L329) +[index.d.ts:330](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L330) --- @@ -96,4 +96,4 @@ Write messages to Kafka. #### Defined in -[index.d.ts:323](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L323) +[index.d.ts:324](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L324) diff --git a/api-docs/docs/interfaces/ConfigEntry.md b/api-docs/docs/interfaces/ConfigEntry.md index 205272b..285ce45 100644 --- a/api-docs/docs/interfaces/ConfigEntry.md +++ b/api-docs/docs/interfaces/ConfigEntry.md @@ -15,7 +15,7 @@ #### Defined in -[index.d.ts:222](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L222) +[index.d.ts:223](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L223) --- @@ -25,4 +25,4 @@ #### Defined in -[index.d.ts:223](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L223) +[index.d.ts:224](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L224) diff --git a/api-docs/docs/interfaces/ConnectionConfig.md b/api-docs/docs/interfaces/ConnectionConfig.md index cdc7409..4d39157 100644 --- a/api-docs/docs/interfaces/ConnectionConfig.md +++ b/api-docs/docs/interfaces/ConnectionConfig.md @@ -16,7 +16,7 @@ #### Defined in -[index.d.ts:209](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L209) +[index.d.ts:210](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L210) --- @@ -26,7 +26,7 @@ #### Defined in -[index.d.ts:210](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L210) +[index.d.ts:211](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L211) --- @@ -36,4 +36,4 @@ #### Defined in -[index.d.ts:211](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L211) +[index.d.ts:212](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L212) diff --git a/api-docs/docs/interfaces/ConsumeConfig.md b/api-docs/docs/interfaces/ConsumeConfig.md index 6757039..aff1fa0 100644 --- a/api-docs/docs/interfaces/ConsumeConfig.md +++ b/api-docs/docs/interfaces/ConsumeConfig.md @@ -5,6 +5,7 @@ ### Properties - [limit](ConsumeConfig.md#limit) +- [nanoPrecision](ConsumeConfig.md#nanoprecision) ## Properties @@ -15,3 +16,13 @@ #### Defined in [index.d.ts:204](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L204) + +--- + +### nanoPrecision + +• **nanoPrecision**: `boolean` + +#### Defined in + +[index.d.ts:205](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L205) diff --git a/api-docs/docs/interfaces/Container.md b/api-docs/docs/interfaces/Container.md index 8703177..21910a8 100644 --- a/api-docs/docs/interfaces/Container.md +++ b/api-docs/docs/interfaces/Container.md @@ -16,7 +16,7 @@ #### Defined in -[index.d.ts:262](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L262) +[index.d.ts:263](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L263) --- @@ -26,7 +26,7 @@ #### Defined in -[index.d.ts:263](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L263) +[index.d.ts:264](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L264) --- @@ -36,4 +36,4 @@ #### Defined in -[index.d.ts:264](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L264) +[index.d.ts:265](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L265) diff --git a/api-docs/docs/interfaces/JKS.md b/api-docs/docs/interfaces/JKS.md index 8a659e7..9eb122d 100644 --- a/api-docs/docs/interfaces/JKS.md +++ b/api-docs/docs/interfaces/JKS.md @@ -16,7 +16,7 @@ #### Defined in -[index.d.ts:277](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L277) +[index.d.ts:278](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L278) --- @@ -26,7 +26,7 @@ #### Defined in -[index.d.ts:278](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L278) +[index.d.ts:279](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L279) --- @@ -36,4 +36,4 @@ #### Defined in -[index.d.ts:279](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L279) +[index.d.ts:280](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L280) diff --git a/api-docs/docs/interfaces/JKSConfig.md b/api-docs/docs/interfaces/JKSConfig.md index d73d37c..ea9dbdf 100644 --- a/api-docs/docs/interfaces/JKSConfig.md +++ b/api-docs/docs/interfaces/JKSConfig.md @@ -19,7 +19,7 @@ #### Defined in -[index.d.ts:270](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L270) +[index.d.ts:271](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L271) --- @@ -29,7 +29,7 @@ #### Defined in -[index.d.ts:271](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L271) +[index.d.ts:272](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L272) --- @@ -39,7 +39,7 @@ #### Defined in -[index.d.ts:272](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L272) +[index.d.ts:273](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L273) --- @@ -49,7 +49,7 @@ #### Defined in -[index.d.ts:269](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L269) +[index.d.ts:270](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L270) --- @@ -59,7 +59,7 @@ #### Defined in -[index.d.ts:268](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L268) +[index.d.ts:269](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L269) --- @@ -69,4 +69,4 @@ #### Defined in -[index.d.ts:273](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L273) +[index.d.ts:274](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L274) diff --git a/api-docs/docs/interfaces/Reference.md b/api-docs/docs/interfaces/Reference.md index ed78bcd..8d25db2 100644 --- a/api-docs/docs/interfaces/Reference.md +++ b/api-docs/docs/interfaces/Reference.md @@ -16,7 +16,7 @@ #### Defined in -[index.d.ts:238](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L238) +[index.d.ts:239](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L239) --- @@ -26,7 +26,7 @@ #### Defined in -[index.d.ts:239](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L239) +[index.d.ts:240](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L240) --- @@ -36,4 +36,4 @@ #### Defined in -[index.d.ts:240](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L240) +[index.d.ts:241](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L241) diff --git a/api-docs/docs/interfaces/ReplicaAssignment.md b/api-docs/docs/interfaces/ReplicaAssignment.md index 2b38aa2..6a2a8d9 100644 --- a/api-docs/docs/interfaces/ReplicaAssignment.md +++ b/api-docs/docs/interfaces/ReplicaAssignment.md @@ -15,7 +15,7 @@ #### Defined in -[index.d.ts:216](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L216) +[index.d.ts:217](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L217) --- @@ -25,4 +25,4 @@ #### Defined in -[index.d.ts:217](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L217) +[index.d.ts:218](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L218) diff --git a/api-docs/docs/interfaces/Schema.md b/api-docs/docs/interfaces/Schema.md index b2e9108..b7c529f 100644 --- a/api-docs/docs/interfaces/Schema.md +++ b/api-docs/docs/interfaces/Schema.md @@ -20,7 +20,7 @@ #### Defined in -[index.d.ts:245](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L245) +[index.d.ts:246](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L246) --- @@ -30,7 +30,7 @@ #### Defined in -[index.d.ts:246](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L246) +[index.d.ts:247](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L247) --- @@ -40,7 +40,7 @@ #### Defined in -[index.d.ts:250](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L250) +[index.d.ts:251](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L251) --- @@ -50,7 +50,7 @@ #### Defined in -[index.d.ts:247](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L247) +[index.d.ts:248](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L248) --- @@ -60,7 +60,7 @@ #### Defined in -[index.d.ts:248](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L248) +[index.d.ts:249](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L249) --- @@ -70,7 +70,7 @@ #### Defined in -[index.d.ts:251](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L251) +[index.d.ts:252](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L252) --- @@ -80,4 +80,4 @@ #### Defined in -[index.d.ts:249](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L249) +[index.d.ts:250](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L250) diff --git a/api-docs/docs/interfaces/SubjectNameConfig.md b/api-docs/docs/interfaces/SubjectNameConfig.md index 5ffbbc8..9b636f1 100644 --- a/api-docs/docs/interfaces/SubjectNameConfig.md +++ b/api-docs/docs/interfaces/SubjectNameConfig.md @@ -17,7 +17,7 @@ #### Defined in -[index.d.ts:257](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L257) +[index.d.ts:258](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L258) --- @@ -27,7 +27,7 @@ #### Defined in -[index.d.ts:255](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L255) +[index.d.ts:256](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L256) --- @@ -37,7 +37,7 @@ #### Defined in -[index.d.ts:258](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L258) +[index.d.ts:259](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L259) --- @@ -47,4 +47,4 @@ #### Defined in -[index.d.ts:256](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L256) +[index.d.ts:257](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L257) diff --git a/api-docs/docs/interfaces/TopicConfig.md b/api-docs/docs/interfaces/TopicConfig.md index a82c2c5..e1665ca 100644 --- a/api-docs/docs/interfaces/TopicConfig.md +++ b/api-docs/docs/interfaces/TopicConfig.md @@ -18,7 +18,7 @@ #### Defined in -[index.d.ts:232](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L232) +[index.d.ts:233](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L233) --- @@ -28,7 +28,7 @@ #### Defined in -[index.d.ts:229](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L229) +[index.d.ts:230](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L230) --- @@ -38,7 +38,7 @@ #### Defined in -[index.d.ts:231](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L231) +[index.d.ts:232](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L232) --- @@ -48,7 +48,7 @@ #### Defined in -[index.d.ts:230](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L230) +[index.d.ts:231](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L231) --- @@ -58,4 +58,4 @@ #### Defined in -[index.d.ts:228](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L228) +[index.d.ts:229](https://github.com/mostafa/xk6-kafka/blob/main/api-docs/index.d.ts#L229) diff --git a/api-docs/index.d.ts b/api-docs/index.d.ts index 755398c..5b69d44 100644 --- a/api-docs/index.d.ts +++ b/api-docs/index.d.ts @@ -202,6 +202,7 @@ export interface ReaderConfig { /* Configuration for Consume method. */ export interface ConsumeConfig { limit: number; + nanoPrecision: boolean; } /* Configuration for creating a Connector instance for working with topics. */ @@ -342,7 +343,7 @@ export class Writer { * }); * * // In VU code (default function) - * const messages = reader.consume({limit: 10}); + * const messages = reader.consume({limit: 10, nanoPrecision: false}); * * // In teardown function * reader.close(); diff --git a/api-docs/yarn.lock b/api-docs/yarn.lock index d87a47d..816cb1f 100644 --- a/api-docs/yarn.lock +++ b/api-docs/yarn.lock @@ -4,24 +4,24 @@ balanced-match@^1.0.0: version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== brace-expansion@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz" integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== dependencies: balanced-match "^1.0.0" fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== glob@^8.0.3: version "8.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" + resolved "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz" integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== dependencies: fs.realpath "^1.0.0" @@ -32,7 +32,7 @@ glob@^8.0.3: handlebars@^4.7.7: version "4.7.7" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" + resolved "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz" integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== dependencies: minimist "^1.2.5" @@ -44,7 +44,7 @@ handlebars@^4.7.7: inflight@^1.0.4: version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== dependencies: once "^1.3.0" @@ -52,56 +52,56 @@ inflight@^1.0.4: inherits@2: version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== jsonc-parser@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22" + resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz" integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA== lunr@^2.3.9: version "2.3.9" - resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" + resolved "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz" integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== marked@^4.0.16: version "4.0.16" - resolved "https://registry.yarnpkg.com/marked/-/marked-4.0.16.tgz#9ec18fc1a723032eb28666100344d9428cf7a264" + resolved "https://registry.npmjs.org/marked/-/marked-4.0.16.tgz" integrity sha512-wahonIQ5Jnyatt2fn8KqF/nIqZM8mh3oRu2+l5EANGMhu6RFjiSG52QNE2eWzFMI94HqYSgN184NurgNG6CztA== minimatch@^5.0.1, minimatch@^5.1.0: version "5.1.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz" integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== dependencies: brace-expansion "^2.0.1" minimist@^1.2.5: version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== neo-async@^2.6.0: version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== once@^1.3.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" prettier@^2.8.1: version "2.8.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.1.tgz" integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg== shiki@^0.10.1: version "0.10.1" - resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.10.1.tgz#6f9a16205a823b56c072d0f1a0bcd0f2646bef14" + resolved "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz" integrity sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng== dependencies: jsonc-parser "^3.0.0" @@ -110,19 +110,19 @@ shiki@^0.10.1: source-map@^0.6.1: version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== typedoc-plugin-markdown@^3.12.1: version "3.12.1" - resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.12.1.tgz#2a33ca0018bdd7ed512e29960d3eb344ecb65f4a" + resolved "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.12.1.tgz" integrity sha512-gMntJq7+JlGJZ5sVjrkzO/rG2dsmNBbWk5ZkcKvYu6QOeBwGcK5tzEyS0aqnFTJj9GCHCB+brAnTuKtAyotNwA== dependencies: handlebars "^4.7.7" typedoc@^0.22.17: version "0.22.17" - resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.22.17.tgz#bc51cc95f569040112504300831cdac4f8089b7b" + resolved "https://registry.npmjs.org/typedoc/-/typedoc-0.22.17.tgz" integrity sha512-h6+uXHVVCPDaANzjwzdsj9aePBjZiBTpiMpBBeyh1zcN2odVsDCNajz8zyKnixF93HJeGpl34j/70yoEE5BfNg== dependencies: glob "^8.0.3" @@ -133,30 +133,30 @@ typedoc@^0.22.17: typescript@^4.7.3: version "4.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz" integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA== uglify-js@^3.1.4: version "3.16.0" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.0.tgz#b778ba0831ca102c1d8ecbdec2d2bdfcc7353190" + resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.16.0.tgz" integrity sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw== vscode-oniguruma@^1.6.1: version "1.6.2" - resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz#aeb9771a2f1dbfc9083c8a7fdd9cccaa3f386607" + resolved "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz" integrity sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA== vscode-textmate@5.2.0: version "5.2.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.2.0.tgz#01f01760a391e8222fe4f33fbccbd1ad71aed74e" + resolved "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz" integrity sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ== wordwrap@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + resolved "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== wrappy@1: version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== diff --git a/reader.go b/reader.go index 39bcb49..f339569 100644 --- a/reader.go +++ b/reader.go @@ -75,7 +75,8 @@ type ReaderConfig struct { } type ConsumeConfig struct { - Limit int64 `json:"limit"` + Limit int64 `json:"limit"` + NanoPrecision bool `json:"nanoPrecision"` } type Duration struct { @@ -346,12 +347,19 @@ func (k *Kafka) consume( return messages } + var messageTime string + if consumeConfig.NanoPrecision { + messageTime = msg.Time.Format(time.RFC3339Nano) + } else { + messageTime = time.Unix(msg.Time.Unix(), 0).Format(time.RFC3339) + } + // Rest of the fields of a given message message := map[string]interface{}{ "topic": msg.Topic, "partition": msg.Partition, "offset": msg.Offset, - "time": time.Unix(msg.Time.Unix(), 0).Format(time.RFC3339), + "time": messageTime, "highWaterMark": msg.HighWaterMark, "headers": make(map[string]interface{}), }