From 6de886c359fe78897234a0b86d352df172cb974c Mon Sep 17 00:00:00 2001 From: David Boyne Date: Mon, 30 Sep 2024 17:09:30 +0100 Subject: [PATCH] chore(docs): added bytes to wing by example also removed numbers in nav (#1029) - Added new example "bytes" for Wing by example. - Removed numbers on the navigation, this lets us manage and add/move things around on this guide easier in the future Closes https://github.com/winglang/wing/issues/7154 --------- Co-authored-by: David Boyne --- .../version-latest/02-hello-world.md | 2 +- .../version-latest/03-values.md | 2 +- .../version-latest/04-variables.md | 2 +- .../version-latest/05-for.md | 2 +- .../version-latest/06-ifelse.md | 2 +- .../version-latest/07-while.md | 2 +- .../version-latest/08-optionality.md | 2 +- .../version-latest/09-arrays.md | 2 +- .../version-latest/10-maps.md | 2 +- .../version-latest/11-sets.md | 2 +- .../version-latest/12-structs.md | 2 +- .../version-latest/13-bytes.md | 29 +++++++++++++++++++ .../13-trailing-struct-parameters.md | 2 +- .../version-latest/14-async-functions.md | 2 +- .../version-latest/14-functions.md | 2 +- .../version-latest/15-variadic-functions.md | 2 +- .../version-latest/16-closures.md | 2 +- .../version-latest/17-recursion.md | 2 +- .../version-latest/18-methods.md | 2 +- .../version-latest/19-interfaces.md | 2 +- .../version-latest/20-sleep.md | 2 +- .../version-latest/21-string-functions.md | 2 +- .../version-latest/22-regex.md | 2 +- .../version-latest/23-Json.md | 2 +- .../version-latest/24-time.md | 2 +- .../version-latest/25-random.md | 2 +- .../version-latest/26-number-parsing.md | 2 +- .../version-latest/27-url-parsing.md | 2 +- .../version-latest/28-sha256.md | 2 +- .../version-latest/29-base64-encoding.md | 2 +- .../30-reading-writing-files.md | 2 +- .../version-latest/31-directories.md | 2 +- .../version-latest/32-testing.md | 2 +- .../version-latest/33-http-client.md | 2 +- .../version-latest/34-http-server.md | 2 +- .../version-latest/35-exec-processes.md | 2 +- 36 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 example_versioned_docs/version-latest/13-bytes.md diff --git a/example_versioned_docs/version-latest/02-hello-world.md b/example_versioned_docs/version-latest/02-hello-world.md index d55b358b..4c6d7454 100644 --- a/example_versioned_docs/version-latest/02-hello-world.md +++ b/example_versioned_docs/version-latest/02-hello-world.md @@ -2,7 +2,7 @@ title: Wing by example id: hello-world slug: /hello-world -sidebar_label: 1. Hello world +sidebar_label: Hello world description: Hello world wing example keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/03-values.md b/example_versioned_docs/version-latest/03-values.md index 71006c63..43c1350a 100644 --- a/example_versioned_docs/version-latest/03-values.md +++ b/example_versioned_docs/version-latest/03-values.md @@ -2,7 +2,7 @@ title: Primitive values id: primitives slug: /primitive-values -sidebar_label: 2. Primitive values +sidebar_label: Primitive values description: Hello world wing example keywords: [Wing language, example, primitives, values] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/04-variables.md b/example_versioned_docs/version-latest/04-variables.md index 9378db5e..f3cf2fb1 100644 --- a/example_versioned_docs/version-latest/04-variables.md +++ b/example_versioned_docs/version-latest/04-variables.md @@ -2,7 +2,7 @@ title: Variables id: Variables slug: /Variables -sidebar_label: 4. Variables +sidebar_label: Variables description: Using variables with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/05-for.md b/example_versioned_docs/version-latest/05-for.md index 20bd993d..62257f92 100644 --- a/example_versioned_docs/version-latest/05-for.md +++ b/example_versioned_docs/version-latest/05-for.md @@ -2,7 +2,7 @@ title: For id: for slug: /for -sidebar_label: 5. For +sidebar_label: For description: Using for loops with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/06-ifelse.md b/example_versioned_docs/version-latest/06-ifelse.md index 7c3dbe87..0925ba15 100644 --- a/example_versioned_docs/version-latest/06-ifelse.md +++ b/example_versioned_docs/version-latest/06-ifelse.md @@ -2,7 +2,7 @@ title: If/Else id: if-else slug: /if-else -sidebar_label: 6. If/Else +sidebar_label: If/Else description: Using if else with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/07-while.md b/example_versioned_docs/version-latest/07-while.md index dd733e5a..78db5b07 100644 --- a/example_versioned_docs/version-latest/07-while.md +++ b/example_versioned_docs/version-latest/07-while.md @@ -2,7 +2,7 @@ title: While id: while slug: /while -sidebar_label: 7. While +sidebar_label: While description: Using while statements with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/08-optionality.md b/example_versioned_docs/version-latest/08-optionality.md index a7dcc8fb..90f39131 100644 --- a/example_versioned_docs/version-latest/08-optionality.md +++ b/example_versioned_docs/version-latest/08-optionality.md @@ -2,7 +2,7 @@ title: Optionality id: optionality slug: /optionality -sidebar_label: 8. Optionality +sidebar_label: Optionality description: Using while statements with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/09-arrays.md b/example_versioned_docs/version-latest/09-arrays.md index 740768dd..589f9209 100644 --- a/example_versioned_docs/version-latest/09-arrays.md +++ b/example_versioned_docs/version-latest/09-arrays.md @@ -2,7 +2,7 @@ title: Arrays id: arrays slug: /arrays -sidebar_label: 9. Arrays +sidebar_label: Arrays description: Using arrays with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/10-maps.md b/example_versioned_docs/version-latest/10-maps.md index d5e6332c..c896f640 100644 --- a/example_versioned_docs/version-latest/10-maps.md +++ b/example_versioned_docs/version-latest/10-maps.md @@ -2,7 +2,7 @@ title: Maps id: maps slug: /maps -sidebar_label: 10. Maps +sidebar_label: Maps description: Using maps with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/11-sets.md b/example_versioned_docs/version-latest/11-sets.md index 5caad221..9e36bc86 100644 --- a/example_versioned_docs/version-latest/11-sets.md +++ b/example_versioned_docs/version-latest/11-sets.md @@ -2,7 +2,7 @@ title: Sets id: sets slug: /sets -sidebar_label: 11. Sets +sidebar_label: Sets description: Using sets with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/12-structs.md b/example_versioned_docs/version-latest/12-structs.md index e5fc3007..28d6db99 100644 --- a/example_versioned_docs/version-latest/12-structs.md +++ b/example_versioned_docs/version-latest/12-structs.md @@ -2,7 +2,7 @@ title: Structs id: structs slug: /structs -sidebar_label: 12. Structs +sidebar_label: Structs description: Using arrays with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/13-bytes.md b/example_versioned_docs/version-latest/13-bytes.md new file mode 100644 index 00000000..c32728e1 --- /dev/null +++ b/example_versioned_docs/version-latest/13-bytes.md @@ -0,0 +1,29 @@ +--- +title: Bytes +id: bytes +slug: /bytes +sidebar_label: Bytes +description: Hash values in Wing with SHA256 +keywords: [Wing language, Hash, SHA256] +image: /img/wing-by-example.png +--- + +When working with binary files like images, audio, or other binary formats, you often need to manipulate data at the byte level. + +```js playground example title="main.w" +// get bytes from raw value +let rawData: bytes = bytes.fromRaw([104, 101, 108, 108, 111]); + +// get the bytes from a string +let rawString: bytes = bytes.fromString("hello"); + +// get bytes from base64 encoded value +let base64: bytes = bytes.fromBase64("aGVsbG8="); + +// get bytes from hex value +let hex: bytes = bytes.fromHex("68656c6c6f"); +``` + + + + diff --git a/example_versioned_docs/version-latest/13-trailing-struct-parameters.md b/example_versioned_docs/version-latest/13-trailing-struct-parameters.md index 6c3db6f5..a9d14c24 100644 --- a/example_versioned_docs/version-latest/13-trailing-struct-parameters.md +++ b/example_versioned_docs/version-latest/13-trailing-struct-parameters.md @@ -2,7 +2,7 @@ title: Trailing struct parameters id: trailing-structs-parameters slug: /trailing-structs-parameters -sidebar_label: 13. Trailing struct parameters +sidebar_label: Trailing struct parameters description: Passing fields directly to a function keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/14-async-functions.md b/example_versioned_docs/version-latest/14-async-functions.md index 0a89b7bc..e381fc6b 100644 --- a/example_versioned_docs/version-latest/14-async-functions.md +++ b/example_versioned_docs/version-latest/14-async-functions.md @@ -2,7 +2,7 @@ title: Inflight functions id: inflight-functions slug: /inflight-functions -sidebar_label: 14. Async inflight functions +sidebar_label: Async inflight functions description: Using functions with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/14-functions.md b/example_versioned_docs/version-latest/14-functions.md index efc63690..f7015cef 100644 --- a/example_versioned_docs/version-latest/14-functions.md +++ b/example_versioned_docs/version-latest/14-functions.md @@ -2,7 +2,7 @@ title: Functions id: functions slug: /functions -sidebar_label: 14. Functions +sidebar_label: Functions description: Using functions with Wing keywords: [Wing language, example] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/15-variadic-functions.md b/example_versioned_docs/version-latest/15-variadic-functions.md index f4e6a51f..92e0598f 100644 --- a/example_versioned_docs/version-latest/15-variadic-functions.md +++ b/example_versioned_docs/version-latest/15-variadic-functions.md @@ -2,7 +2,7 @@ title: Variadic Functions id: variadic-functions slug: /variadic-functions -sidebar_label: 15. Variadic Functions +sidebar_label: Variadic Functions description: Using variadic functions with Wing keywords: [Wing language, variadic] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/16-closures.md b/example_versioned_docs/version-latest/16-closures.md index 962add01..b38d28d9 100644 --- a/example_versioned_docs/version-latest/16-closures.md +++ b/example_versioned_docs/version-latest/16-closures.md @@ -2,7 +2,7 @@ title: Closures id: closures slug: /closures -sidebar_label: 16. Closures +sidebar_label: Closures description: Closures with Wing keywords: [Wing language, variadic] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/17-recursion.md b/example_versioned_docs/version-latest/17-recursion.md index 9e973300..22e545a1 100644 --- a/example_versioned_docs/version-latest/17-recursion.md +++ b/example_versioned_docs/version-latest/17-recursion.md @@ -2,7 +2,7 @@ title: Recursion id: recursion slug: /recursion -sidebar_label: 17. Recursion +sidebar_label: Recursion description: Recursion with Wing keywords: [Wing language, variadic] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/18-methods.md b/example_versioned_docs/version-latest/18-methods.md index 134ad2af..0b283b78 100644 --- a/example_versioned_docs/version-latest/18-methods.md +++ b/example_versioned_docs/version-latest/18-methods.md @@ -2,7 +2,7 @@ title: Methods id: methods slug: /methods -sidebar_label: 18. Methods +sidebar_label: Methods description: Methods with Wing keywords: [Wing language, variadic] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/19-interfaces.md b/example_versioned_docs/version-latest/19-interfaces.md index aa160e8f..7171084c 100644 --- a/example_versioned_docs/version-latest/19-interfaces.md +++ b/example_versioned_docs/version-latest/19-interfaces.md @@ -2,7 +2,7 @@ title: Interfaces id: interfaces slug: /interfaces -sidebar_label: 19. Interfaces +sidebar_label: Interfaces description: Interfaces with Wing keywords: [Wing language, interfaces] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/20-sleep.md b/example_versioned_docs/version-latest/20-sleep.md index a2e67d74..1acf0811 100644 --- a/example_versioned_docs/version-latest/20-sleep.md +++ b/example_versioned_docs/version-latest/20-sleep.md @@ -2,7 +2,7 @@ title: Sleep id: sleep slug: /sleep -sidebar_label: 20. Sleep +sidebar_label: Sleep description: Suspends execution for a given duration. keywords: [Wing language, sleep] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/21-string-functions.md b/example_versioned_docs/version-latest/21-string-functions.md index d10262d4..20e6c174 100644 --- a/example_versioned_docs/version-latest/21-string-functions.md +++ b/example_versioned_docs/version-latest/21-string-functions.md @@ -2,7 +2,7 @@ title: String functions id: string-functions slug: /string-functions -sidebar_label: 21. String functions +sidebar_label: String functions description: Functions for string values in Wing keywords: [Wing language, string, functions] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/22-regex.md b/example_versioned_docs/version-latest/22-regex.md index e13722c9..5e0432bd 100644 --- a/example_versioned_docs/version-latest/22-regex.md +++ b/example_versioned_docs/version-latest/22-regex.md @@ -2,7 +2,7 @@ title: Regular expressions id: regex slug: /regex -sidebar_label: 22. Regular expressions +sidebar_label: Regular expressions description: Functions for string values in Wing keywords: [Wing language, string, functions] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/23-Json.md b/example_versioned_docs/version-latest/23-Json.md index af0fa482..31427a44 100644 --- a/example_versioned_docs/version-latest/23-Json.md +++ b/example_versioned_docs/version-latest/23-Json.md @@ -2,7 +2,7 @@ title: Json id: json slug: /json -sidebar_label: 23. Json +sidebar_label: Json description: Create Json values in Wing keywords: [Wing language, json] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/24-time.md b/example_versioned_docs/version-latest/24-time.md index 4c269196..a3223afe 100644 --- a/example_versioned_docs/version-latest/24-time.md +++ b/example_versioned_docs/version-latest/24-time.md @@ -2,7 +2,7 @@ title: Time id: time slug: /time -sidebar_label: 24. Time +sidebar_label: Time description: Create time/date values in Wing keywords: [Wing language, time, date] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/25-random.md b/example_versioned_docs/version-latest/25-random.md index 46de2a7c..badc2474 100644 --- a/example_versioned_docs/version-latest/25-random.md +++ b/example_versioned_docs/version-latest/25-random.md @@ -2,7 +2,7 @@ title: Random id: random slug: /random -sidebar_label: 25. Random +sidebar_label: Random description: Create random values in Wing keywords: [Wing language, random] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/26-number-parsing.md b/example_versioned_docs/version-latest/26-number-parsing.md index 0b2389a6..8041de31 100644 --- a/example_versioned_docs/version-latest/26-number-parsing.md +++ b/example_versioned_docs/version-latest/26-number-parsing.md @@ -2,7 +2,7 @@ title: Number parsing id: number-parsing slug: /number-parsing -sidebar_label: 26. Number Parsing +sidebar_label: Number Parsing description: Parse values into numbers keywords: [Wing language, random] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/27-url-parsing.md b/example_versioned_docs/version-latest/27-url-parsing.md index 07ac0fb1..28d00563 100644 --- a/example_versioned_docs/version-latest/27-url-parsing.md +++ b/example_versioned_docs/version-latest/27-url-parsing.md @@ -2,7 +2,7 @@ title: URL parsing id: url-parsing slug: /url-parsing -sidebar_label: 27. URL parsing +sidebar_label: URL parsing description: Parse urls in Wing keywords: [Wing language, URL] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/28-sha256.md b/example_versioned_docs/version-latest/28-sha256.md index a9f0a25d..45f5d631 100644 --- a/example_versioned_docs/version-latest/28-sha256.md +++ b/example_versioned_docs/version-latest/28-sha256.md @@ -2,7 +2,7 @@ title: SHA256 Hashes id: sha256 slug: /sha256 -sidebar_label: 28. SHA256 Hashes +sidebar_label: SHA256 Hashes description: Hash values in Wing with SHA256 keywords: [Wing language, Hash, SHA256] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/29-base64-encoding.md b/example_versioned_docs/version-latest/29-base64-encoding.md index 43ee3303..096ffccc 100644 --- a/example_versioned_docs/version-latest/29-base64-encoding.md +++ b/example_versioned_docs/version-latest/29-base64-encoding.md @@ -2,7 +2,7 @@ title: Base64 Encoding id: base64-encoding slug: /base64-encoding -sidebar_label: 29. Base64 Encoding +sidebar_label: Base64 Encoding description: Encode and decode Base64 values keywords: [Wing language, Base64] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/30-reading-writing-files.md b/example_versioned_docs/version-latest/30-reading-writing-files.md index 6687a7b0..b624ff9c 100644 --- a/example_versioned_docs/version-latest/30-reading-writing-files.md +++ b/example_versioned_docs/version-latest/30-reading-writing-files.md @@ -2,7 +2,7 @@ title: Reading and writing files id: reading-and-writing-files slug: /reading-and-writing-files -sidebar_label: 30. Reading and writing files +sidebar_label: Reading and writing files description: Reading and writing files with Wing keywords: [Wing language, Reading files, Writing files] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/31-directories.md b/example_versioned_docs/version-latest/31-directories.md index cae04463..27aac338 100644 --- a/example_versioned_docs/version-latest/31-directories.md +++ b/example_versioned_docs/version-latest/31-directories.md @@ -2,7 +2,7 @@ title: Directories id: directories slug: /directories -sidebar_label: 31. Directories +sidebar_label: Directories description: Directories keywords: [Wing language, Directories] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/32-testing.md b/example_versioned_docs/version-latest/32-testing.md index 1403cb05..7274e2f1 100644 --- a/example_versioned_docs/version-latest/32-testing.md +++ b/example_versioned_docs/version-latest/32-testing.md @@ -2,7 +2,7 @@ title: Testing id: testing slug: /testing -sidebar_label: 32. Testing +sidebar_label: Testing description: Directories keywords: [Wing language, Directories] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/33-http-client.md b/example_versioned_docs/version-latest/33-http-client.md index 527c11b9..ab71152f 100644 --- a/example_versioned_docs/version-latest/33-http-client.md +++ b/example_versioned_docs/version-latest/33-http-client.md @@ -2,7 +2,7 @@ title: HTTP Client id: http-client slug: /http-client -sidebar_label: 33. HTTP Client +sidebar_label: HTTP Client description: Directories keywords: [Wing language, HTTP] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/34-http-server.md b/example_versioned_docs/version-latest/34-http-server.md index fda1415f..61e702d4 100644 --- a/example_versioned_docs/version-latest/34-http-server.md +++ b/example_versioned_docs/version-latest/34-http-server.md @@ -2,7 +2,7 @@ title: HTTP Server id: http-server slug: /http-server -sidebar_label: 33. HTTP Server +sidebar_label: HTTP Server description: Directories keywords: [Wing language, HTTP] image: /img/wing-by-example.png diff --git a/example_versioned_docs/version-latest/35-exec-processes.md b/example_versioned_docs/version-latest/35-exec-processes.md index 39fd3ab4..f3a10ee6 100644 --- a/example_versioned_docs/version-latest/35-exec-processes.md +++ b/example_versioned_docs/version-latest/35-exec-processes.md @@ -2,7 +2,7 @@ title: Exec processes id: exec-processed slug: /exec-processed -sidebar_label: 35. Exec processes +sidebar_label: Exec processes description: Exec'ing Processes keywords: [Wing language, HTTP] image: /img/wing-by-example.png