Skip to content

Commit 3263c41

Browse files
obx-viviengreenrobot
authored andcommitted
Various improvements: fix mdx generation, css, logo, added search, etc.
1 parent b1e5af0 commit 3263c41

23 files changed

+1154
-209
lines changed

convert_gitbook_to_mdx.py

Lines changed: 304 additions & 13 deletions
Large diffs are not rendered by default.

website/README.mdx

Lines changed: 0 additions & 51 deletions
This file was deleted.

website/docs/SUMMARY.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import TabItem from "@theme/TabItem"
44

55
# Table of contents
66

7-
* [ObjectBox C / C++ Database](README.md)
8-
* [Installation](installation.md)
9-
* [How to get started](getting-started.md)
10-
* [Entity Annotations](entity-annotations.md)
11-
* [Generator](generator.md)
12-
* [Store](store.md)
13-
* [Queries](queries.md)
14-
* [Relations](relations.md)
15-
* [Transactions](transactions.md)
16-
* [Schema Changes](schema-changes.md)
17-
* [Time Series Data](time-series-data.md)
18-
* [Dev Tools and Debugging](dev-tools-and-debugging.md)
19-
* [FAQ](faq.md)
7+
* [ObjectBox C / C++ Database](README)
8+
* [Installation](installation)
9+
* [How to get started](getting-started)
10+
* [Entity Annotations](entity-annotations)
11+
* [Generator](generator)
12+
* [Store](store)
13+
* [Queries](queries)
14+
* [Relations](relations)
15+
* [Transactions](transactions)
16+
* [Schema Changes](schema-changes)
17+
* [Time Series Data](time-series-data)
18+
* [Dev Tools and Debugging](dev-tools-and-debugging)
19+
* [FAQ](faq)
2020
* [GitHub](https://github.com/objectbox/objectbox-c)
2121
* [ObjectBox Generator](https://github.com/objectbox/objectbox-generator)
2222
* [C API docs](https://objectbox.io/docfiles/c/current/)

website/docs/entity-annotations.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The following annotations are currently supported:
6969

7070
* **name** - specifies the name to use in the database if it's desired to be different than what the FlatBuffer schema "table" is called.
7171
* **transient** - this entity is skipped, no code is generated for it. Useful if you have custom FlatBuffer handling but still want to generate ObjectBox binding code for some parts of the same file.
72-
* **uid** - used to explicitly specify UID used with this entity; used when renaming entities. See [Schema changes](schema-changes.md) for more details.
72+
* **uid** - used to explicitly specify UID used with this entity; used when renaming entities. See [Schema changes](schema-changes) for more details.
7373
* **relation** - adds a standalone (many-to-many) relation, usually to another entity. Example: creating a relation to the authors of a book: `objectbox:relation(name=authors,to=Author)`
7474
* **sync** - enables synchronization for the entity - only relevant with [ObjectBox Sync](https://objectbox.io/sync/) library builds. Entities not marked with this annotation will not be synchronized to the server, i.e. they're local-only.
7575
* `sync(sharedGlobalIds)` can be used to switch from the default behaviour (ID-mapping) to using a global ID space. This flag tells ObjectBox to treat object IDs globally and thus no ID mapping (local `<->` global) is performed. Often this is used with `id(assignable)` annotation and some special ID scheme.
@@ -89,5 +89,5 @@ The following annotations are currently supported:
8989
* **relation** - declares the field as a relation ID, linking to another Entity which must be specified as a value of this annotation.
9090
* **name** - specifies the name to use in the database if it's desired to be different than what the FlatBuffer schema "field" is called.
9191
* **transient** - this property is skipped, no code is generated for it. Useful if you have custom FlatBuffer handling but still want to generate ObjectBox binding code for the entity.
92-
* **uid** - used to explicitly specify UID used with this property; used when renaming properties. See [Schema changes](schema-changes.md) for more details.
92+
* **uid** - used to explicitly specify UID used with this property; used when renaming properties. See [Schema changes](schema-changes) for more details.
9393
* **unique** - set to enforce that values are unique before an entity is inserted/updated. A `put` operation will abort and return an error if the unique constraint is violated.

website/docs/generator.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ This is the reference guide on the ObjectBox Generator, a build-time tool for Ob
1515

1616

1717
:::info
18-
For an intro to the generator, see also the [installation guide](installation.md#objectbox-generator) and [Generating Binding Code](getting-started.md#generating-binding-code).
18+
For an intro to the generator, see also the [installation guide](installation#objectbox-generator) and [Generating Binding Code](getting-started#generating-binding-code).
1919
:::
2020

21-
When using ObjectBox within your project, you typically need two things: the runtime library and the the build-time ObjectBox Generator. The generator takes a data model (see [Entity Annotations](entity-annotations.md)) as input and generates `struct`s, a data model representation as code and additional glue code for a tight and fast integration of your individual data types and the ObjectBox API.
21+
When using ObjectBox within your project, you typically need two things: the runtime library and the the build-time ObjectBox Generator. The generator takes a data model (see [Entity Annotations](entity-annotations)) as input and generates `struct`s, a data model representation as code and additional glue code for a tight and fast integration of your individual data types and the ObjectBox API.
2222

23-
If you are using CMake, it's highly recommended to use the CMake integration of the ObjectBox Generator. For all other setups, triggering the generator in [standalone mode](generator.md#standalone) is also supported.
23+
If you are using CMake, it's highly recommended to use the CMake integration of the ObjectBox Generator. For all other setups, triggering the generator in [standalone mode](generator#standalone) is also supported.
2424

2525
:::info
2626
The ObjectBox Generator binary is currently not available for Linux/Windows ARM architectures (pull requests are welcome). The macOS as universal binary supports ARM64 and AMD64 architectures.
@@ -32,7 +32,7 @@ The ObjectBox Generator is well integrated into CMake.&#x20;
3232

3333
Enabling the Generator via CMake
3434

35-
Once you have the ObjectBox runtime library set up via `FetchContent` (see [installation](installation.md)), it only takes one more command to enable the Generator:
35+
Once you have the ObjectBox runtime library set up via `FetchContent` (see [installation](installation)), it only takes one more command to enable the Generator:
3636

3737
```cmake
3838
# Note: downloads automatically if not found locally
@@ -91,7 +91,7 @@ By default, generated files (except the model JSON file) are written relative to
9191

9292
### Details on finding the CMake module
9393

94-
The CMake module is implicitly downloaded together with objectbox shared libraries as described in [Installation](installation.md).\
94+
The CMake module is implicitly downloaded together with objectbox shared libraries as described in [Installation](installation).\
9595
\
9696
The latest version of the find module is also available from [https://raw.githubusercontent.com/objectbox/objectbox-generator/main/cmake/FindObjectBoxGenerator.cmake](https://raw.githubusercontent.com/objectbox/objectbox-generator/main/cmake/FindObjectBoxGenerator.cmake)
9797

website/docs/getting-started.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ObjectBox Generator produces binding code for ObjectBox C & C++ APIs. This great
1818
### Generating binding code
1919

2020
:::info
21-
ObjectBox Generator is a tool, which must be [downloaded separately](https://github.com/objectbox/objectbox-generator/releases). For details, please check the [installation](installation.md) page.
21+
ObjectBox Generator is a tool, which must be [downloaded separately](https://github.com/objectbox/objectbox-generator/releases). For details, please check the [installation](installation) page.
2222
:::
2323

2424
ObjectBox Generator uses FlatBuffer schema file (.fbs) as its primary input. The Generator also maintains some metadata around the data model in a JSON file (objectbox-model.json). Based on these two files, it generates code for the selected language (C or C++).&#x20;
@@ -52,7 +52,7 @@ The following files will be generated:
5252
* tasklist.obx.cpp
5353

5454
:::info
55-
See [#cmake-support](generator.md#cmake-support "mention")for details on CMake integration.
55+
See [#cmake-support](generator#cmake-support "mention")for details on CMake integration.
5656
:::
5757

5858
</TabItem>
@@ -233,7 +233,7 @@ handle_error: // print error and clean up
233233
234234
If you've followed the installation instructions, you should be able to compile the example
235235
236-
If you are using CMake, like shown in the [installation section](installation.md#cmake-3.14), just add the generated `tasklist.obx.cpp` file to the `myapp` target.
236+
If you are using CMake, like shown in the [installation section](installation#cmake-3.14), just add the generated `tasklist.obx.cpp` file to the `myapp` target.
237237
238238
The `add_executable` call in the CMake file now looks like this:
239239
@@ -263,7 +263,7 @@ gcc main.c -I. -lobjectbox -lflatccrt
263263
</Tabs>
264264
265265
:::info
266-
The command snippet assumes you have [the libraries installed](installation.md) in a path recognized by your OS (e.g. /usr/local/lib/) and all the referenced headers are in the same folder alongside the main.c/.cpp file.
266+
The command snippet assumes you have [the libraries installed](installation) in a path recognized by your OS (e.g. /usr/local/lib/) and all the referenced headers are in the same folder alongside the main.c/.cpp file.
267267
:::
268268
269269
Wherever you have access to a Box, you can use it to persist objects and fetch objects from disk. **Boxes are thread-safe.** Here are some of the basic operations, have a look at the objectbox.h(pp) for more:

website/docs/installation.mdx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ FetchContent_MakeAvailable(objectbox)
3939
4040
add_executable(myapp main.cpp)
4141
target_link_libraries(myapp objectbox)
42-
```
43-
44-
45-
42+
```cmake
4643
If you want to use an ObjectBox Sync variant of the library, change the `target_link_libraries` to:&#x20;
4744
4845
```cmake
@@ -73,8 +70,7 @@ endif()
7370
7471
add_executable(myapp main.cpp)
7572
target_link_libraries(myapp objectbox)
76-
```
77-
73+
```cmake
7874
If you want to integrate the ObjectBox-Generator via CMake (as an alternative to offline installation and pre-generation of C++ sources), use the following snippet:
7975
8076
```cmake
@@ -88,8 +84,7 @@ add_obx_schema(
8884
INSOURCE # Opt-in: Generate in source directory
8985
CXX_STANDARD 11 # Defaults to C++14 otherwise
9086
)
91-
```
92-
87+
```cmake
9388
\
9489
If you want to use an ObjectBox Sync variant of the library, change the list line to:&#x20;
9590
@@ -204,7 +199,7 @@ Try running `objectbox-generator -help` to verify the installation and see the o
204199
</TabItem>
205200
</Tabs>
206201

207-
For more details, please refer to the [Generator documentation page](generator.md).
202+
For more details, please refer to the [Generator documentation page](generator).
208203

209204
## FlatBuffers
210205

@@ -241,13 +236,13 @@ For special setups, the objectbox.hpp header also allows a configuration, which
241236
:::
242237

243238
</TabItem>
244-
<TabItem value="cmake1" label="C without CMake">
239+
<TabItem value="c" label="C without CMake">
245240

246241
Get [flatcc library and headers](https://github.com/dvidelabs/flatcc). You can link your program to the to the static runtime library.
247242

248243
CMake example (check the link above for the latest version):
249244

250-
```
245+
```c
251246
FetchContent_Declare(
252247
flatcc
253248
GIT_REPOSITORY https://github.com/dvidelabs/flatcc.git

website/docs/queries.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ OBX_bytes_array* bytes_array = obx_query_find(query, 0, 0);
7878
```
7979
8080
:::info
81-
`obx_query_find()` needs to be executed inside an explicit read transaction to avoid data copy while preserving its validity (so that concurrent threads won't change the data while you read it). We're omitting this in the examples to keep them simple, see [Transactions](transactions.md#read-transactions) for more details.
81+
`obx_query_find()` needs to be executed inside an explicit read transaction to avoid data copy while preserving its validity (so that concurrent threads won't change the data while you read it). We're omitting this in the examples to keep them simple, see [Transactions](transactions#read-transactions) for more details.
8282
:::
8383
8484
</TabItem>
@@ -210,7 +210,7 @@ users = query.find();
210210
</TabItem>
211211
<TabItem value="c" label="C">
212212
213-
```
213+
```c
214214
uint64_t offset = 10;
215215
uint64_t limit = 5;
216216
OBX_bytes_array* bytes_array = obx_query_find(query, offset, limit);

website/docs/schema-changes.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The ObjectBox C / C++ database comes with automatic schema migration. Learn all
1616

1717
ObjectBox manages its data model (schema) mostly automatically. The data model is defined by the Entities you define in FlatBuffer schema files. When you **add or remove** entities or properties of your entities, **ObjectBox takes care** of those changes when you launch `objectbox-generator` on the changed `.fbs` file without any further action needed from you.
1818

19-
For other changes like **renaming or changing the type**, ObjectBox needs **extra information** to make things unambiguous. This works using unique identifiers (UIDs) specified by the [uid annotation](entity-annotations.md#supported-annotations), as we will see below.
19+
For other changes like **renaming or changing the type**, ObjectBox needs **extra information** to make things unambiguous. This works using unique identifiers (UIDs) specified by the [uid annotation](entity-annotations#supported-annotations), as we will see below.
2020

2121
## Renaming Entities and Properties <a href="#renaming-entities-and-properties" id="renaming-entities-and-properties"></a>
2222

@@ -57,7 +57,7 @@ uid annotation value must not be empty:
5757
```
5858

5959
:::info
60-
Note how for a property, the output is slightly different. It's because you have two options, either renaming the property or resetting (clearing) it's stored data. See [Reset data - new UID on a property](schema-changes.md#reset-data-new-uid-on-a-property) for more details.
60+
Note how for a property, the output is slightly different. It's because you have two options, either renaming the property or resetting (clearing) it's stored data. See [Reset data - new UID on a property](schema-changes#reset-data-new-uid-on-a-property) for more details.
6161
:::
6262

6363
&#x20;**Step 3:** Apply the UID printed in the error message to your entity/property:

website/docs/store.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ obx::Store store(options);
277277
</TabItem>
278278
<TabItem value="c" label="C">
279279

280-
```
280+
```c
281281
OBX_store_options* opt = obx_opt();
282282
obx_opt_async_max_in_tx_duration(opt, 1000);
283283
obx_store_open(opt);
@@ -304,7 +304,7 @@ Available options for fine-tuning asynchronous operations:
304304
305305
### Debug Flags
306306
307-
When debugging or fine-tuning performance you can enable [logging](dev-tools-and-debugging.md#logging) of various events at the info level.
307+
When debugging or fine-tuning performance you can enable [logging](dev-tools-and-debugging#logging) of various events at the info level.
308308
309309
<Tabs>
310310
<TabItem value="cpp" label="C++">
@@ -335,8 +335,8 @@ obx_store_open(opt);
335335
336336
Once you created the store, it gives you access to several ways to interact with the data you store in it; aka the database:
337337
338-
* [**Box API**](getting-started.md#working-with-object-boxes)**:** easy to use object-based API with implicit transactions. It is used in combination with the ObjectBox Generator, which generates the source code for data and Box classes. Check the getting started track for examples.
339-
* [**Query API**](queries.md)**:** In combination with the Box API, you can build powerful queries using the query builder. Once built, query instances can be executed multiple times to retrieve data.&#x20;
340-
* [**Explicit Transactions**](transactions.md)**:** Often it's a good idea to group several operations into a single "batch", or more precisely, one transaction. Batched transactions are not only faster, but also consider safe state changes for your data.
338+
* [**Box API**](getting-started#working-with-object-boxes)**:** easy to use object-based API with implicit transactions. It is used in combination with the ObjectBox Generator, which generates the source code for data and Box classes. Check the getting started track for examples.
339+
* [**Query API**](queries)**:** In combination with the Box API, you can build powerful queries using the query builder. Once built, query instances can be executed multiple times to retrieve data.&#x20;
340+
* [**Explicit Transactions**](transactions)**:** Often it's a good idea to group several operations into a single "batch", or more precisely, one transaction. Batched transactions are not only faster, but also consider safe state changes for your data.
341341
342342

0 commit comments

Comments
 (0)